-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512
On June 2, 2014 10:18:40 PM GMT+03:00, Axel Bender <[email protected]> wrote: >virtcol() fails to deliver the correct screen column if showbreak is >set to a value other than "" and wrap is on, i.e. it doesn't take into >account the length of the string that showbreak is set to. > >To reproduce: > >1) Start a "bare" gvim with a text containing a long line. >2) :set nowrap >3) Position the cursor at the beginning of a word towards the end of >the line. >4) :echo virtcol(".") >5) :set wrap " Make sure the cursor is in a 'wrapped' line >6) :echo virtcol(".") " Returns the same value >7) :set showbreak=(-->) >8) :echo virtcol(".") " Will return a distinct value > >col(".")'s return value would not change, but it's not Unicode (UTF-8) >proof... Neither is virtcol(). In Unicode you have the following things: - - Variable-length tabs. - - Control characters which take one byte and occupy two or four cells (depending on vim settings). - - Fullwidth characters that are 2 cells wide. - - Ambiguous width characters which are one or two cells wide depending on terminal and vim settings. - - Combining characters which are zero cells wide (and are sometimes considered a part of a symbol). - - Unprintable characters which occupy at least 6 cells (e.g. U+FFFE represented as <fffe>). Additionally there are - - Incorrect bytes that vim represents as <XX>. - - Different terminal encodings which may alter Unicode character representation (I have not tested how though). . All this affect output of virtcol(). If you want to count a number of characters you should use something different. If you need exactly display cells do not say it has something to do with Unicode. In the last case you may use col(), getline() and strdisplaywidth(). -----BEGIN PGP SIGNATURE----- Version: APG v1.1.1 iQI1BAEBCgAfBQJTjboSGBxaeVggPHp5eC52aW1AZ21haWwuY29tPgAKCRCf3UKj HhHSvvKPEAClwRq4OAAsuVjxZiqjfjkntq3jbai29zetIWEVS75pO4lZDYr6mHqD xa9+KVFNxUzKby8zh1CYQpp0+rU2dO0XW53j6lhYRKW+t2QfswPjC4TX3wECdJKv uuQQa2m/khnWpXV0mUizainIj3MWPVNu89/5xqcE7vyGAlq+kTl8N2h7l8933+Y0 2GAydQit6T6c8DK5h2P/v/uZrokSSKaF7zhdwo9RxFlzpX09fmX1llkllB1TxMF3 jvGhLlLAnrgVj8DFWabj6xCij8zchHc1vw4qRy8vVJEGllTyDSAQHyQm2rvmrrzw 5ZuIbr/w6DgdJKwM98qH9QedPFpxVfziv7S0hGTzyknvxr5HM1Ct4ac3MilewSY/ N/NDczDdB+OPUq7zluuvXMdASDIiNcCYQWd1uCyEcZogapjmZ1xT60FQFm+QLZ9e RIrnBSPsx5lJl1V6Hpm4minAPQfXEdfXovF+I6rHVjuBfBQvn/KcDt13mdriYzwQ jXyrNg7Ys2mdxq3exlWUcVbiBeb57eg518ihw6pvZghagFizV3BV8CB7WJwjqmME 2I8pTmsmPL3RxbAlnP49b1K4DqqamrsiwCFQVycG2RKrLxyzNC9QbU0WUaagHuen 473Fy3wAOk7OUzgNV3H2k7aEQpq7lYG1LsJ+LorCx73TV96X9dIhSw== =ONg5 -----END PGP SIGNATURE----- -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
