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#18195: 24.3.92; window-screen-lines is not accurate Date: Tue, 05 Aug 2014 16:46:45 +0300 Message-ID: <8338dbqcai.fsf@gnu.org> References: <86tx5r7l1j.fsf@yandex.ru> <53E097F7.5050407@gmx.at> <53E0ABF9.7070506@yandex.ru> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1407246446 26992 80.91.229.3 (5 Aug 2014 13:47:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 5 Aug 2014 13:47:26 +0000 (UTC) Cc: 18195@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Aug 05 15:47:20 2014 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 1XEf5D-0003CO-0z for geb-bug-gnu-emacs@m.gmane.org; Tue, 05 Aug 2014 15:47:19 +0200 Original-Received: from localhost ([::1]:59546 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XEf5C-0003qx-Do for geb-bug-gnu-emacs@m.gmane.org; Tue, 05 Aug 2014 09:47:18 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36208) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XEf52-0003ip-7h for bug-gnu-emacs@gnu.org; Tue, 05 Aug 2014 09:47:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XEf4w-00084c-Kp for bug-gnu-emacs@gnu.org; Tue, 05 Aug 2014 09:47:08 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:51408) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XEf4w-00084Y-Hl for bug-gnu-emacs@gnu.org; Tue, 05 Aug 2014 09:47:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XEf4v-0001SN-V9 for bug-gnu-emacs@gnu.org; Tue, 05 Aug 2014 09:47: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: Tue, 05 Aug 2014 13:47:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18195 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 18195-submit@debbugs.gnu.org id=B18195.14072464055575 (code B ref 18195); Tue, 05 Aug 2014 13:47:01 +0000 Original-Received: (at 18195) by debbugs.gnu.org; 5 Aug 2014 13:46:45 +0000 Original-Received: from localhost ([127.0.0.1]:58351 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XEf4f-0001Rq-0Z for submit@debbugs.gnu.org; Tue, 05 Aug 2014 09:46:45 -0400 Original-Received: from mtaout25.012.net.il ([80.179.55.181]:49824) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XEf4c-0001RZ-45 for 18195@debbugs.gnu.org; Tue, 05 Aug 2014 09:46:43 -0400 Original-Received: from conversion-daemon.mtaout25.012.net.il by mtaout25.012.net.il (HyperSendmail v2007.08) id <0N9U005005Z3TR00@mtaout25.012.net.il> for 18195@debbugs.gnu.org; Tue, 05 Aug 2014 16:41:45 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by mtaout25.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0N9U00NPS61LJX70@mtaout25.012.net.il>; Tue, 05 Aug 2014 16:41:45 +0300 (IDT) In-reply-to: <53E0ABF9.7070506@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:92132 Archived-At: > Date: Tue, 05 Aug 2014 14:03:37 +0400 > From: Dmitry Gutov > > On 08/05/2014 12:38 PM, martin rudalics wrote: > > IIUC > > > > https://github.com/company-mode/company-mode/issues/160#issuecomment-51022508 > > > > mentioned in that thread, all you want is to display all lines of a > > completion buffer. Is that correct? > > Not at all. Have you tried Company? > > This issue is about completion popup, which displays completions in the > current buffer and window, in a rectangle rendered using an overlay. > There are screenshots in that issue thread. > > Before the popup is rendered, we need to determine how much of it would > fit below the current line, and if there's not enough space, we render > it above the current line. I fixed window-screen-lines. However, please note that you are on a slippery slope doing this. Emacs currently doesn't provide Lisp interfaces that would allow to perform such layout tasks from Lisp with reliable results. Overlays and text properties were never supposed to be used for layout purposes. For example, AFAIU, your code currently assumes that the font used for popup is the same as the one used for the underlying buffer text. But since you provide faces for the popup, a user could legitimately customize those faces to use a different font, and thus invalidate your calculations, because window-screen-lines uses the metrics of the default face's font. And that is just an example of what could go wrong when you try to do what in Emacs can only be done reliably by the display engine. IMO, instead of overloading existing display features with jobs they were never designed to do, and then live forever with the situation where development breaks the resulting applications (like the pixel-wise resizing of windows did with this one), it would be a much better investment of energy to come up with requirements for Lisp APIs that could be used by applications for laying out text. These requirements, when implemented, would then benefit everybody, and allow solid dependable applications that don't break that often.