vim / vim

The official Vim repository
https://www.vim.org
Vim License
35.6k stars 5.34k forks source link

Wrong semantic highlighting in python r-string #12962

Open GNUqb114514 opened 10 months ago

GNUqb114514 commented 10 months ago

Steps to reproduce

  1. Write a r-string in a python file which include an slash like r"\";
  2. write anything like abc on the right of the r-string. And it will be r"\"abc;
  3. enable the semantic highlight. The text on the right of the r-string (abc in our example) is incorrectly colored the same as the string on the left like this: 图片

Expected behaviour

Because of python's r-string feature, the slash will be a normal character. But in that highlight sample, the slash be a special character which let the quote on its right side to be a normal character incorrectly.

Version of Vim

9.0.1-1679

Environment

OS: Ubuntu 22.04 Terminal: GNOME Terminal 3.44 $TERM: xterm-256color shell: GNU bash 5.1.16(1) Full output of vim --version:

VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Aug  9 2023 17:03:37)
Included patches: 1-1679
Compiled by qb114514@qb114514-VirtualBox
Huge version without GUI.  Features included (+) or not (-):
+acl               +file_in_path      +mouse_urxvt       -tag_any_white
+arabic            +find_in_path      +mouse_xterm       -tcl
+autocmd           +float             +multi_byte        +termguicolors
+autochdir         +folding           +multi_lang        +terminal
-autoservername    -footer            -mzscheme          +terminfo
-balloon_eval      +fork()            +netbeans_intg     +termresponse
+balloon_eval_term -gettext           +num64             +textobjects
-browse            -hangul_input      +packages          +textprop
++builtin_terms    +iconv             +path_extra        +timers
+byte_offset       +insert_expand     -perl              +title
+channel           +ipv6              +persistent_undo   -toolbar
+cindent           +job               +popupwin          +user_commands
-clientserver      +jumplist          +postscript        +vartabs
-clipboard         +keymap            +printer           +vertsplit
+cmdline_compl     +lambda            +profile           +vim9script
+cmdline_hist      +langmap           -python            +viminfo
+cmdline_info      +libcall           +python3           +virtualedit
+comments          +linebreak         +quickfix          +visual
+conceal           +lispindent        +reltime           +visualextra
+cryptv            +listcmds          +rightleft         +vreplace
+cscope            +localmap          +ruby              +wildignore
+cursorbind        -lua               +scrollbind        +wildmenu
+cursorshape       +menu              +signs             +windows
+dialog_con        +mksession         +smartindent       +writebackup
+diff              +modify_fname      -sodium            -X11
+digraphs          +mouse             -sound             -xfontset
-dnd               -mouseshape        +spell             -xim
-ebcdic            +mouse_dec         +startuptime       -xpm
+emacs_tags        -mouse_gpm         +statusline        -xsmp
+eval              -mouse_jsbterm     -sun_workshop      -xterm_clipboard
+ex_extra          +mouse_netterm     +syntax            -xterm_save
+extra_search      +mouse_sgr         +tag_binary        
-farsi             -mouse_sysmouse    -tag_old_static    
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/usr/local/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -g -O2 -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 
Linking: gcc -L/usr/local/lib -Wl,--as-needed -o vim -lm -ltinfo -L/usr/lib/python3.10/config-3.10-x86_64-linux-gnu -lpython3.10 -lcrypt -ldl -lm -lm -lruby-3.0 -lm -L/usr/lib

(It's compiled by myself which only opened support of some language for pluggings)

Logs and stack traces

No response

dkearns commented 10 months ago

Related to #10734