From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Native display of line numbers: visual line-counting Date: Tue, 27 Jun 2017 18:00:17 +0300 Message-ID: <834lv1scfy.fsf@gnu.org> References: <83podttfpy.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1498575700 6387 195.159.176.226 (27 Jun 2017 15:01:40 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 27 Jun 2017 15:01:40 +0000 (UTC) Cc: emacs-devel@gnu.org To: Filipe Silva Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jun 27 17:01:29 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dPrzS-00017L-RU for ged-emacs-devel@m.gmane.org; Tue, 27 Jun 2017 17:01:18 +0200 Original-Received: from localhost ([::1]:53296 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dPrzX-0003I3-TE for ged-emacs-devel@m.gmane.org; Tue, 27 Jun 2017 11:01:23 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57558) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dPryn-0003Gr-1a for emacs-devel@gnu.org; Tue, 27 Jun 2017 11:00:38 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dPryj-0006r8-0D for emacs-devel@gnu.org; Tue, 27 Jun 2017 11:00:37 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:53849) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dPryi-0006qi-TA; Tue, 27 Jun 2017 11:00:32 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:4392 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1dPryh-0005iu-7o; Tue, 27 Jun 2017 11:00:32 -0400 In-reply-to: (message from Filipe Silva on Tue, 27 Jun 2017 10:29:28 -0300) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:216024 Archived-At: > From: Filipe Silva > Date: Tue, 27 Jun 2017 10:29:28 -0300 > > Having the real line number instead of 0 would give us a more useful information instead of just 0, but showing > 0 is totally fine if it makes the implementation easier. It doesn't matter from the implementation POV, so real line number it is. > in vim, the visual relative line number does not take into account wrapped lines. if a line is big enough that > spans multiple lines in the buffer, all of that count as 1 and only the first segment of the wrapper line is > numbered. you can always use 'gj' to navigate wrapper lines. This contradicts the only set of requirements I saw posted about this (by several people): show line numbers that are consistent with vertical movement commands like C-n and C-p. Which means wrapped lines should be counted, as Emacs moves visually, at least by default. > Yes, org-mode and folding are the only cases I know off that would require a visual relative line number > implementation. I don't know what is display properties, nor before and after strings. Can someone state an > example ? If you use magit, you have a lot of them, I think. Here's a toy example, due to Dmitry. Evaluate this in *scratch*, then switch to the popup-test.el buffer. The multi-line "aaaaa" part is an overlay after-string. (with-current-buffer (get-buffer-create "popup-test.el") (setq display-line-numbers t) (insert "aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa ") (let ((ov (make-overlay (point-max) (point-max)))) (overlay-put ov 'after-string "bbbbbb\nbbbbbb\n") (overlay-put ov 'display-line-numbers-disable t)))