Skip to content

dac is fooled by braced text following the command #2628

@Aster89

Description

@Aster89

Description

Probably this "bug" has no solution, unless we have a list of \commands and the number of arguments they take. Or we can have some heuristics.

Indeed, this is a command, \textbf{url}, followed by some braced \emphasised text,

\textbf{url} {\em text}

whereas this is one command, i.e. a link to url with text an \emphasized text, and nothings else

\href{url}{\em text}

Currently dac interprets both in the latter way, so it correctly deletes the whole thing in the latter case, but mistakenly deletes the whole thing in the former case too.

I'm not sure what the correct behavior should be. Maybe we shoud determine the number of arguments of a command by requiring that two following args are not separated by just whitespace? For instance, something like this could be accomplished,

\cmd{}{} % 2-args command
\cmd{} {} % 1-arg command followed by braced stuff
    \cmd{}
    {} % 1-arg command followed by braced stuff
    \cmd{}%
    {} % 2-args command
    \cmd{}
{} % 2-args command

Steps to reproduce

Put this text in a TeX file

\textbf{some bold} {\em some emphasis}

then hit dac (cursor anywhere before the space).

Expected behavior

Only \textbf{some bold} should be deleted.

Actual behavior

All the \textbf{some bold} {\em some emphasis} is deleted.

Do you use a latexmkrc file?

No

VimtexInfo

System info:
  OS: Arch Linux
  Vim version: VIM 9.0 (1-1182)
  Has clientserver: true
  Servername: VIM1

VimTeX project: main
  base: main.tex
  root: /home/enrico/the-unfolding-of-language
  tex: /home/enrico/the-unfolding-of-language/main.tex
  main parser: fallback
  document class: book
  packages: amsbsy amsgen amsmath amsopn amstext array atbegshi-ltx atveryend-ltx auxhook babel biblatex bigintcalc bitset blx-case-expl3 booktabs cancel caption caption3 cleveref csquotes datatool-base datatool-fp defpattern emptypage environ epigraph epstopdf-base etexcmds etoolbox expl3 fancyhdr fontenc fontspec fontspec-luatex fp fp-addons fp-basic fp-eqn fp-eval fp-exp fp-pas fp-random fp-snap fp-trigo fp-upn gettitlestring glossaries glossaries-compatible-307 glossary-hypernav glossary-list glossary-long glossary-super glossary-tree graphics graphicx hycolor hyperref ifluatex ifoddpage iftex ifthen ifxetex imakeidx indentfirst infwarerr inputenc intcalc keyval kvdefinekeys kvoptions kvsetkeys l3keys2e letltxmacro lipsum listings logreq longtable lstmisc ltcaption ltxcmds makecell mfirstuc multicol nameref nextpage ninecolors pdfcol pdfescape pdftexcmds pgf pgfcomp-version-0-65 pgfcomp-version-1-18 pgfcore pgffor pgfkeys pgfmath pgfrcs pgfsys postnotes quoting refcount rerunfilecheck shellesc siunitx spath3 stringenc subfig substr supertabular tabularray tabularx tcolorbox textcase tikz tikzpagenodes tracklang translations translator trig trimspaces uniquecounter url verbatim xcolor xfor xfp xkeyval xparse
  source files:
    main.tex
    src/packages.tex
    src/glossary.tex
    src/custom-commands.tex
    ../../../usr/share/texmf-dist/tex/latex/tools/.tex
    src/introduction.tex
    src/chapters/a-castle-in-the-air.tex
    src/chapters/perpetual-motion.tex
    src/chapters/the-forces-of-destruction.tex
    src/chapters/a-reef-of-dead-metaphors.tex
    src/chapters/the-forces-of-creation.tex
    src/chapters/craving-for-order.tex
    src/chapters/the-unfolding-of-language.tex
    src/epilogue.tex
    img/munintumaa.tex
    src/appendixes/flipping-categories.tex
    src/appendixes/laryngeals-again.tex
    src/appendixes/the-devil-in-the-detail.tex
    src/appendixes/the-cook-s-counterpoint.tex
    src/appendixes/the-turkish-mirror.tex
  compiler: latexmk
    engine: -pdf
    options:
      -shell-escape
      -verbose
      -synctex=1
      -interaction=nonstopmode
    callback: 1
    continuous: 1
    executable: latexmk
  viewer: Zathura
    xwin id: 0
  qf method: LaTeX logfile using pplatex

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions