To: vim_dev@googlegroups.com Subject: Patch 8.2.3776 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.3776 Problem: When a tags file line is long a tag may not be found. Solution: When increasing the buffer size read the same line again. Files: src/tag.c, src/testdir/test_taglist.vim *** ../vim-8.2.3775/src/tag.c 2021-12-07 12:23:53.987565086 +0000 --- src/tag.c 2021-12-10 20:12:51.946060457 +0000 *************** *** 2011,2018 **** eof = vim_fgets(lbuf, lbuf_size, fp); if (!eof && search_info.curr_offset != 0) { - // The explicit cast is to work around a bug in gcc 3.4.2 - // (repeated below). search_info.curr_offset = vim_ftell(fp); if (search_info.curr_offset == search_info.high_offset) { --- 2011,2016 ---- *************** *** 2052,2058 **** --- 2050,2059 ---- eof = cs_fgets(lbuf, lbuf_size); else #endif + { + search_info.curr_offset = vim_ftell(fp); eof = vim_fgets(lbuf, lbuf_size, fp); + } } while (!eof && vim_isblankline(lbuf)); if (eof) *************** *** 2294,2299 **** --- 2295,2304 ---- lbuf = alloc(lbuf_size); if (lbuf == NULL) goto findtag_end; + + if (state == TS_STEP_FORWARD) + // Seek to the same position to read the same line again + vim_fseek(fp, search_info.curr_offset, SEEK_SET); #ifdef FEAT_TAG_BINS // this will try the same thing again, make sure the offset is // different *** ../vim-8.2.3775/src/testdir/test_taglist.vim 2020-09-04 20:18:40.488161918 +0100 --- src/testdir/test_taglist.vim 2021-12-10 20:12:25.518074372 +0000 *************** *** 236,239 **** --- 236,258 ---- set tags& endfunc + func Test_tag_complete_with_overlong_line() + let tagslines =<< trim END + !_TAG_FILE_FORMAT 2 // + !_TAG_FILE_SORTED 1 // + !_TAG_FILE_ENCODING utf-8 // + inboundGSV a 1;" r + inboundGovernor a 2;" kind:⊢ type:forall (muxMode :: MuxMode) socket peerAddr versionNumber m a b. (MonadAsync m, MonadCatch m, MonadEvaluate m, MonadThrow m, MonadThrow (STM m), MonadTime m, MonadTimer m, MonadMask m, Ord peerAddr, HasResponder muxMode ~ True) => Tracer m (RemoteTransitionTrace peerAddr) -> Tracer m (InboundGovernorTrace peerAddr) -> ServerControlChannel muxMode peerAddr ByteString m a b -> DiffTime -> MuxConnectionManager muxMode socket peerAddr versionNumber ByteString m a b -> StrictTVar m InboundGovernorObservableState -> m Void + inboundGovernorCounters a 3;" kind:⊢ type:InboundGovernorState muxMode peerAddr m a b -> InboundGovernorCounters + END + call writefile(tagslines, 'Xtags') + set tags=Xtags + + call feedkeys(":tag inbou\\\"\", 'xt') + call assert_equal('"tag inboundGSV inboundGovernor inboundGovernorCounters', @:) + + call delete('Xtags') + set tags& + endfunc + " vim: shiftwidth=2 sts=2 expandtab *** ../vim-8.2.3775/src/version.c 2021-12-10 16:55:53.515240212 +0000 --- src/version.c 2021-12-10 20:05:03.770107589 +0000 *************** *** 755,756 **** --- 755,758 ---- { /* Add new patch number below this line */ + /**/ + 3776, /**/ -- "Making it up? Why should I want to make anything up? Life's bad enough as it is without wanting to invent any more of it." -- Marvin, the Paranoid Android in Douglas Adams' "The Hitchhiker's Guide to the Galaxy" /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///