Konfekt / vim-latexencode

convert UTF-8 characters to LaTeX commandos in Vim via pylatexenc
1 stars 1 forks source link

feat: visual selection string is transcriped instead of visual lines. #3

Open timtro opened 1 year ago

timtro commented 1 year ago

As per Issue #2.

Discussion points

Issues

I ran into a bug when converting the authors in the enclosing braces.

  author = {Stephen Lack and Ji{\v{r}}{\'i} Rosick{\'y}},

But when I vi} to select the authors and :'<,'>Latex2Text I get

  author = {Stephen Lack and Jirí Rosický},

or (in my buffer it reads)

  author = {Stephen Lack and Ji^Krí Rosický},

I'm not sure if the issue is related to latexencode or if the endocding is getting screwed up in my handling of strings. But it has worked fine with a half-dozen or so other entries.

timtro commented 1 year ago

I tracked down the issue: shellescape doesn't escape backslashes. I'll fix that and push it later today. I'm tied up for a bit.

timtro commented 1 year ago

Following ab206f6, there is still an issue with the latexencode#get_visual_selection function, which fails when the selection ends in an accented character. This is a problem for :LatexEncode. Other than that, in most cases forward then reverse transcription is identity, as expected.

Seems to be related to this: https://vi.stackexchange.com/questions/30984/how-do-i-work-with-vim9-and-unicode

I will look at it later, but I obviously don't recommend merging until you or I fix it.