From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#20847: [display engine] 25.0.50; company-mode popup makes point jump to an entirely different location Date: Fri, 19 Jun 2015 22:07:47 +0300 Message-ID: <83mvzvjz3w.fsf@gnu.org> References: <868ubgld8y.fsf@yandex.ru> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1434740971 13264 80.91.229.3 (19 Jun 2015 19:09:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 19 Jun 2015 19:09:31 +0000 (UTC) Cc: 20847@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jun 19 21:09:18 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Z61f5-0005sG-Ni for geb-bug-gnu-emacs@m.gmane.org; Fri, 19 Jun 2015 21:09:11 +0200 Original-Received: from localhost ([::1]:59718 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z61f5-0008Q8-0K for geb-bug-gnu-emacs@m.gmane.org; Fri, 19 Jun 2015 15:09:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57789) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z61f1-0008Q1-5i for bug-gnu-emacs@gnu.org; Fri, 19 Jun 2015 15:09:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z61ex-0007eg-4J for bug-gnu-emacs@gnu.org; Fri, 19 Jun 2015 15:09:07 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:50788) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z61ex-0007eS-0w for bug-gnu-emacs@gnu.org; Fri, 19 Jun 2015 15:09:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Z61ew-0007fg-K4 for bug-gnu-emacs@gnu.org; Fri, 19 Jun 2015 15:09:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 19 Jun 2015 19:09:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 20847 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 20847-submit@debbugs.gnu.org id=B20847.143474088529414 (code B ref 20847); Fri, 19 Jun 2015 19:09:02 +0000 Original-Received: (at 20847) by debbugs.gnu.org; 19 Jun 2015 19:08:05 +0000 Original-Received: from localhost ([127.0.0.1]:52234 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z61dz-0007eL-AS for submit@debbugs.gnu.org; Fri, 19 Jun 2015 15:08:04 -0400 Original-Received: from mtaout25.012.net.il ([80.179.55.181]:47810) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z61dv-0007dm-KP for 20847@debbugs.gnu.org; Fri, 19 Jun 2015 15:08:01 -0400 Original-Received: from conversion-daemon.mtaout25.012.net.il by mtaout25.012.net.il (HyperSendmail v2007.08) id <0NQ700100GO54C00@mtaout25.012.net.il> for 20847@debbugs.gnu.org; Fri, 19 Jun 2015 22:03:30 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by mtaout25.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NQ700IETGXUYC80@mtaout25.012.net.il>; Fri, 19 Jun 2015 22:03:30 +0300 (IDT) In-reply-to: <868ubgld8y.fsf@yandex.ru> X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:104131 Archived-At: > From: Dmitry Gutov > Date: Fri, 19 Jun 2015 04:04:45 +0300 > > 1. Install company (from GNU ELPA, for instance). > > 2. Paste the contents of > https://gist.githubusercontent.com/sooheon/97a62f433897b52da3d1/raw/a42af658ec3ccd11a4faa7e2581f7413687b1811/gistfile1.txt > into the scratch buffer. > > 3. Look for the line with "hello halleo helo" at the end of the first > paragraph, and delete or add a few characters before it, to make sure > that the last "h" is two columns away from the right window border. So > as when you type "el" after it, the cursor is displayed in the margin. > > 4. M-x company-mode > > 5. (setq company-backends '(company-dabbrev)) > > 6. Go to after the last "h", type "el", wait 0.3 seconds, see the > completion popup displayed, while the cursor is displayed in the margin. > > Problem 1: even though the overlay's `cursor' property places it at the > same line as where "hel" ends, the cursor is rendered in the margin two > lines below. I'm halfway through investigating this, and this is what I saw till now: . There's no 'cursor' property on the overlay string that Company creates for its "tooltip" of completions. Or at least I couldn't find that property: I tried both "M-x describe-text-properties" and looking at the overlay string in GDB -- I see no 'cursor' property, certainly not on the newline that starts the string. If indeed there is such a property there, please tell how to see it. . In any case, you cannot put the 'cursor' property on a newline and hope it to work: the newline doesn't leave any glyphs on display, certainly not when the cursor is displayed on the fringe. So the display engine doesn't know you've put the 'cursor' property there. . The overlay string generated by Company in this case is problematic: it puts a newline at the end of each screen line, and that removes the last character of each screen line from display. I don't understand why you need to insert newlines when the original text lines were one long continued line. This is a bug in Company. > Problem 2: > > 7. Type "l", see it wrapped to the next line. > > 8. Type backspace. See the cursor move to the second paragraph. > > 9. Continue backspacing. See the completion popup disappear, and the text > being deleted in the second paragraph. I didn't yet finish debugging this part, but I clearly see that some code actually _moves_ point to that place in the second paragraph, I'm not yet sure why. For starters, if you turn off font-lock in the buffer, this second problem doesn't happen at all. I see some weird interaction between JIT Font Lock and the post-command-hook installed by Company, they seem to somehow conspire to force point to move to that place. I'll try to debug more to see why this happens. (Any idea why Company's post-command-hook calls sit-for, thus forcing redisplay?)