To: vim-dev@vim.org Subject: Patch 5.6.069 Fcc: outbox From: Bram Moolenaar ------------ Patch 5.6.069 Problem: "go" doesn't always end up at the right character when 'fileformat' is "dos". (Bruce DeVisser) Solution: Correct computations in ml_find_line_or_offset(). Files: src/memline. *** ../vim-5.6.68/src/memline.c Fri Mar 31 14:23:12 2000 --- src/memline.c Sat Apr 22 22:37:34 2000 *************** *** 4142,4147 **** --- 4142,4148 ---- int text_end; long offset; int len; + int ffdos = (get_fileformat(buf) == EOL_DOS); if (buf->b_ml.ml_usedchunks == -1 || buf->b_ml.ml_chunksize == NULL *************** *** 4164,4176 **** && ((line && line >= curline + buf->b_ml.ml_chunksize[curix].mlcs_numlines) || (offset ! && offset >= size + buf->b_ml.ml_chunksize[curix].mlcs_totalsize))) { curline += buf->b_ml.ml_chunksize[curix].mlcs_numlines; size += buf->b_ml.ml_chunksize[curix].mlcs_totalsize; ! curix++; ! if (offset && get_fileformat(buf) == EOL_DOS) size += buf->b_ml.ml_chunksize[curix].mlcs_numlines; } while ((line && curline < line) || (offset && size < offset)) --- 4165,4178 ---- && ((line && line >= curline + buf->b_ml.ml_chunksize[curix].mlcs_numlines) || (offset ! && offset >= size + buf->b_ml.ml_chunksize[curix].mlcs_totalsize ! + ffdos * buf->b_ml.ml_chunksize[curix].mlcs_numlines))) { curline += buf->b_ml.ml_chunksize[curix].mlcs_numlines; size += buf->b_ml.ml_chunksize[curix].mlcs_totalsize; ! if (offset && ffdos) size += buf->b_ml.ml_chunksize[curix].mlcs_numlines; + curix++; } while ((line && curline < line) || (offset && size < offset)) *************** *** 4199,4218 **** else { while (offset >= size ! + text_end - (int)((dp->db_index[idx]) & DB_INDEX_MASK)) { if (idx == count - 1) break; idx++; - if (get_fileformat(buf) == EOL_DOS) - size++; } } len = text_end - ((dp->db_index[idx]) & DB_INDEX_MASK); size += len; if (offp != NULL && size >= offset) { ! if (size == offset) *offp = 0; else if (idx == start_idx) *offp = offset - size + len; --- 4201,4221 ---- else { while (offset >= size ! + text_end - (int)((dp->db_index[idx]) & DB_INDEX_MASK) ! + ffdos) { + if (ffdos) + size++; if (idx == count - 1) break; idx++; } } len = text_end - ((dp->db_index[idx]) & DB_INDEX_MASK); size += len; if (offp != NULL && size >= offset) { ! if (size + ffdos == offset) *offp = 0; else if (idx == start_idx) *offp = offset - size + len; *************** *** 4224,4230 **** curline = buf->b_ml.ml_locked_high + 1; } ! if (get_fileformat(buf) == EOL_DOS) size += line - 1; return size; } --- 4227,4233 ---- curline = buf->b_ml.ml_locked_high + 1; } ! if (ffdos) size += line - 1; return size; } *** ../vim-5.6.68/src/version.c Sat Apr 22 22:52:31 2000 --- src/version.c Sat Apr 22 22:50:31 2000 *************** *** 420,421 **** --- 420,423 ---- { /* Add new patch number below this line */ + /**/ + 69, /**/ -- hundred-and-one symptoms of being an internet addict: 123. You ask the car dealer to install an extra cigarette lighter on your new car to power your notebook. /-/-- Bram Moolenaar --- Bram@moolenaar.net --- http://www.moolenaar.net --\-\ \-\-- Vim: http://www.vim.org ---- ICCF Holland: http://www.vim.org/iccf --/-/