To: vim-dev@vim.org Subject: Patch 5.6.010 Fcc: outbox From: Bram Moolenaar ------------ Patch 5.6.010 Problem: A file name which contains a TAB was not read correctly from the viminfo file and the ":ls" listing was not aligned properly. Solution: Parse the buffer list lines in the viminfo file from the end backwards. Count a Tab for two characters to align the ":ls" list. Files: src/buffer.c *** ../vim-5.6.9/src/buffer.c Wed Dec 15 13:54:07 1999 --- src/buffer.c Wed Jan 26 10:34:43 2000 *************** *** 1461,1466 **** --- 1461,1467 ---- { BUF *buf; int len; + int i; for (buf = firstbuf; buf != NULL && !got_int; buf = buf->b_next) { *************** *** 1483,1495 **** len = STRLEN(IObuff); IObuff[len++] = '"'; ! /* ! * try to put the "line" strings in column 40 ! */ do { IObuff[len++] = ' '; ! } while (len < 40 && len < IOSIZE - 18); sprintf((char *)IObuff + len, "line %ld", buf == curbuf ? curwin->w_cursor.lnum : (long)buflist_findlnum(buf)); --- 1484,1497 ---- len = STRLEN(IObuff); IObuff[len++] = '"'; ! ! /* put "line 999" in column 40 or after the file name */ ! IObuff[len] = NUL; ! i = 40 - vim_strsize(IObuff); do { IObuff[len++] = ' '; ! } while (--i > 0 && len < IOSIZE - 18); sprintf((char *)IObuff + len, "line %ld", buf == curbuf ? curwin->w_cursor.lnum : (long)buflist_findlnum(buf)); *************** *** 2610,2625 **** /* don't read in if there are files on the command-line or if writing: */ if (!writing && arg_file_count == 0 && find_viminfo_parameter('%') != NULL) { ! tab = vim_strchr(line + 1, '\t'); lnum = 0; col = 0; if (tab != NULL) { *tab++ = '\0'; ! lnum = atol((char *)tab); ! tab = vim_strchr(tab, '\t'); if (tab != NULL) ! col = atoi((char *)tab + 1); } /* Expand "~/" in the file name at "line + 1" to a full path. --- 2612,2632 ---- /* don't read in if there are files on the command-line or if writing: */ if (!writing && arg_file_count == 0 && find_viminfo_parameter('%') != NULL) { ! /* Format is: Tab Tab . ! * Watch out for a Tab in the file name, work from the end. */ lnum = 0; col = 0; + tab = vim_strrchr(line + 1, '\t'); if (tab != NULL) { *tab++ = '\0'; ! col = atoi((char *)tab); ! tab = vim_strrchr(line + 1, '\t'); if (tab != NULL) ! { ! *tab++ = '\0'; ! lnum = atol((char *)tab); ! } } /* Expand "~/" in the file name at "line + 1" to a full path. *** ../vim-5.6.9/src/version.c Wed Jan 26 10:39:47 2000 --- src/version.c Wed Jan 26 10:38:53 2000 *************** *** 420,421 **** --- 420,423 ---- { /* Add new patch number below this line */ + /**/ + 10, /**/ -- ARTHUR: I am your king! WOMAN: Well, I didn't vote for you. ARTHUR: You don't vote for kings. WOMAN: Well, 'ow did you become king then? The Quest for the Holy Grail (Monty Python) /-/-- Bram Moolenaar --- Bram@moolenaar.net --- http://www.moolenaar.net --\-\ \ \ Vim: http://www.vim.org ICCF Holland: http://www.vim.org/iccf / /