view runtime/syntax/dot.vim @ 32876:522f16e3e058 v9.0.1747

patch 9.0.1747: screenpos() may cause unnecessary redraw Commit: https://github.com/vim/vim/commit/6235a109c48ff2559eca3b16578c429ffb61eadc Author: zeertzjq <zeertzjq@outlook.com> Date: Sat Aug 19 14:12:42 2023 +0200 patch 9.0.1747: screenpos() may cause unnecessary redraw Problem: screenpos() may cause unnecessary redraw. Solution: Don't unnecessarily reset VALID_WROW flag. VALID_WROW flag is only used by two functions: validate_cursor() and cursor_valid(), and cursor_valid() is only used once in ex_sleep(). When adjust_plines_for_skipcol() was first added in patch 9.0.0640, it was called in two functions: comp_botline() and curs_rows(). - comp_botline() is called in two places: - onepage(), which resets VALID_WROW flag immediately afterwards. - validate_botline_win(), where resetting a VALID_ flag is strange. - curs_rows() is called in two places: - curs_columns(), which sets VALID_WROW flag afterwards. - validate_cline_row(), which is only used by GUI mouse focus. Therefore resetting VALID_WROW there doesn't seem to do anything useful. Also, a w_skipcol check (which resets VALID_WROW flag) was added to check_cursor_moved() in patch 9.0.0734, which seems to make more sense than resetting that flag in the middle of a computation. While at it make adjust_plines_for_skipcol() and textpos2screenpos() a bit less confusing: - Make adjust_plines_for_skipcol() return "off" instead of "n - off". - Use 0-based "row" in textpos2screenpos() until W_WINROW is added. closes: #12832 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: zeertzjq <zeertzjq@outlook.com>
author Christian Brabandt <cb@256bit.org>
date Sat, 19 Aug 2023 14:30:02 +0200
parents 4ab4ef0c48b1
children
line wrap: on
line source

" Language:     Dot
" Filenames:    *.dot
" Maintainer:   Markus Mottl  <markus.mottl@gmail.com>
" URL:          http://www.ocaml.info/vim/syntax/dot.vim
" Last Change:  2021 Mar 24 - better attr + escape string matching, new keywords (Farbod Salamat-Zadeh)
"               2011 May 17 - improved identifier matching + two new keywords
"               2001 May 04 - initial version

" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
if version < 600
  syntax clear
elseif exists("b:current_syntax")
  finish
endif

let s:keepcpo = &cpo
set cpo&vim

" Errors
syn match    dotParErr     ")"
syn match    dotBrackErr   "]"
syn match    dotBraceErr   "}"

" Enclosing delimiters
syn region   dotEncl transparent matchgroup=dotParEncl start="(" matchgroup=dotParEncl end=")" contains=ALLBUT,dotParErr
syn region   dotEncl transparent matchgroup=dotBrackEncl start="\[" matchgroup=dotBrackEncl end="\]" contains=ALLBUT,dotBrackErr
syn region   dotEncl transparent matchgroup=dotBraceEncl start="{" matchgroup=dotBraceEncl end="}" contains=ALLBUT,dotBraceErr

" Comments
syn region   dotComment start="//" end="$" contains=dotComment,dotTodo
syn region   dotComment start="/\*" end="\*/" contains=dotComment,dotTodo
syn keyword  dotTodo contained TODO FIXME XXX

" Strings
syn region   dotString    start=+"+ skip=+\\\\\|\\"+ end=+"+

" Escape strings
syn match    dotEscString /\v\\(N|G|E|T|H|L)/ containedin=dotString
syn match    dotEscString /\v\\(n|l|r)/       containedin=dotString

" General keywords
syn keyword  dotKeyword graph digraph subgraph node edge strict

" Node, edge and graph attributes
syn keyword  dotType _background area arrowhead arrowsize arrowtail bb bgcolor
      \ center charset class clusterrank color colorscheme comment compound
      \ concentrate constraint Damping decorate defaultdist dim dimen dir
      \ diredgeconstraints distortion dpi edgehref edgetarget edgetooltip
      \ edgeURL epsilon esep fillcolor fixedsize fontcolor fontname fontnames
      \ fontpath fontsize forcelabels gradientangle group head_lp headclip
      \ headhref headlabel headport headtarget headtooltip headURL height href
      \ id image imagepath imagepos imagescale inputscale K label label_scheme
      \ labelangle labeldistance labelfloat labelfontcolor labelfontname
      \ labelfontsize labelhref labeljust labelloc labeltarget labeltooltip
      \ labelURL landscape layer layerlistsep layers layerselect layersep 
      \ layout len levels levelsgap lhead lheight lp ltail lwidth margin
      \ maxiter mclimit mindist minlen mode model mosek newrank nodesep 
      \ nojustify normalize notranslate nslimit nslimit1 ordering orientation
      \ outputorder overlap overlap_scaling overlap_shrink pack packmode pad
      \ page pagedir pencolor penwidth peripheries pin pos quadtree quantum
      \ rank rankdir ranksep ratio rects regular remincross repulsiveforce
      \ resolution root rotate rotation samehead sametail samplepoints scale
      \ searchsize sep shape shapefile showboxes sides size skew smoothing
      \ sortv splines start style stylesheet tail_lp tailclip tailhref 
      \ taillabel tailport tailtarget tailtooltip tailURL target tooltip
      \ truecolor URL vertices viewport voro_margin weight width xdotversion 
      \ xlabel xlp z

" Special chars
syn match    dotKeyChar  "="
syn match    dotKeyChar  ";"
syn match    dotKeyChar  "->"
syn match    dotKeyChar  "--"

" Identifier
syn match    dotIdentifier /\<\w\+\(:\w\+\)\?\>/

" Synchronization
syn sync minlines=50
syn sync maxlines=500

" Define the default highlighting.
" For version 5.7 and earlier: only when not done already
" For version 5.8 and later: only when an item doesn't have highlighting yet
if version >= 508 || !exists("did_dot_syntax_inits")
  if version < 508
    let did_dot_syntax_inits = 1
    command -nargs=+ HiLink hi link <args>
  else
    command -nargs=+ HiLink hi def link <args>
  endif

  HiLink dotParErr	 Error
  HiLink dotBraceErr	 Error
  HiLink dotBrackErr	 Error

  HiLink dotComment	 Comment
  HiLink dotTodo	 Todo

  HiLink dotParEncl	 Keyword
  HiLink dotBrackEncl	 Keyword
  HiLink dotBraceEncl	 Keyword

  HiLink dotKeyword	 Keyword
  HiLink dotType	 Type
  HiLink dotKeyChar	 Keyword

  HiLink dotString	 String
  HiLink dotEscString	 Keyword
  HiLink dotIdentifier	 Identifier

  delcommand HiLink
endif

let b:current_syntax = "dot"

let &cpo = s:keepcpo
unlet s:keepcpo

" vim: ts=8