From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Implementing Vertical Text support in Emacs Date: Sat, 10 Sep 2022 19:17:35 +0300 Message-ID: <83leqr9pb4.fsf@gnu.org> References: <83r13sttj6.fsf@gnu.org> <87wndi6xau.fsf@yahoo.com> <83mtebq0nd.fsf@gnu.org> <838rmtelfg.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39651"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: =?utf-8?B?4KS44KSu4KWA4KSwIOCkuOCkv+CkguCkuSBTYW1lZXIgU2luZ2g=?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Sep 10 18:19:23 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oX3CV-000A8f-4v for ged-emacs-devel@m.gmane-mx.org; Sat, 10 Sep 2022 18:19:23 +0200 Original-Received: from localhost ([::1]:40492 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oX3CT-0006VX-OQ for ged-emacs-devel@m.gmane-mx.org; Sat, 10 Sep 2022 12:19:21 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49562) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oX3B6-0005lh-7Y for emacs-devel@gnu.org; Sat, 10 Sep 2022 12:17:58 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:36960) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oX3B5-00054T-U1; Sat, 10 Sep 2022 12:17:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=vvm6oj/OyjE9vxt5j64R/n57e7Yho+efCPu6LM8ujY0=; b=KHM3ifA86HWe+1C7GhYc LOxoWeVB4tqLdcoPQaLBCNXnHHWU4IKsZ11/gBxpxiUoHON0KY1of5A+j2YUDaT+f5G4FFMrvdCta AucxbHniOGIsrd8au/Bl0m6fpNnoHOv35lWUMH2BaACKf9rCU8jjrlBNzX7QwHaoY9eLG6ExqiU90 8EIflHmwdoEk3udK9wOZKpnz/q44VS2Au8UCOSnaq6Vni6ZqkpUOqNcYlNTUwbkoy4UPDA7luwnEO 3ITaKzwDh39j2DBc2YNF2QZlSM4I8meIqKQjvasgSn6RPNWuS0RBsw9hBIfUdiM77qknLwLOb26H/ zoqfq+wJ08jMdw==; Original-Received: from [87.69.77.57] (port=4102 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oX3B4-0002wt-M2; Sat, 10 Sep 2022 12:17:55 -0400 In-Reply-To: (message from =?utf-8?B?4KS44KSu4KWA4KSwIOCkuOCkv+CkguCkuQ==?= Sameer Singh on Sat, 10 Sep 2022 21:23:32 +0530) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:295138 Archived-At: > From: समीर सिंह Sameer Singh > Date: Sat, 10 Sep 2022 21:23:32 +0530 > Cc: emacs-devel@gnu.org > > In order to find the "real meat" of the display_line function I started to slowly remove most of the lines of the > function as long as it does not break emacs and text can be typed. > > In the end I was left with this a 20-25 lines function (excluding comments and spaces): > (I have attached this function too) > > static bool > display_line (struct it *it, int cursor_vpos) > { > struct glyph_row *row = it->glyph_row; > > /* Clear the result glyph row and enable it. */ > prepare_desired_row (it->w, row, false); > > row->y = it->current_y; > > /* Loop generating characters. The loop is left with IT on the next > character to display. */ > while (true) > { > > /* Retrieve the next thing to display. Value is false if end of > buffer reached. */ > if (!get_next_display_element (it)) > { > break; > } > > PRODUCE_GLYPHS (it); > > at_end_of_line: > /* Is this a line end? If yes, we're also done, after making > sure that a non-default face is extended up to the right > margin of the window. */ > if (ITERATOR_AT_END_OF_LINE_P (it)) > { > /* Consume the line end. This skips over invisible lines. */ > set_iterator_to_next (it, true); > break; > } > > set_iterator_to_next (it, true); > } > > /* Compute pixel dimensions of this line. */ > compute_line_metrics (it); > > /* Prepare for the next line. This line starts horizontally at (X > HPOS) = (0 0). Vertical positions are incremented. As a > convenience for the caller, IT->glyph_row is set to the next > row to be used. */ > > it->current_y += row->height; > ++it->glyph_row; > return MATRIX_ROW_DISPLAYS_TEXT_P (row); > } > > Obviously most of the things do not work such as bidi, word wrapping, displaying cursor and line numbers but > still text is being shown > in rows one after the other and it can be scrolled, but now there are no lines mentioning the hpos, the > x-coordinate, first_visible_x or > last_visible_x, does that mean I do not understand the display_line function? I thought its function was to fill a > row with glyphs in the desired matrix > to display it on the glass but now I cannot find a line which fills the matrix. That hides behind the PRODUCE_GLYPHS macro. > You had advised to swap the x and y > coordinates, but here there > is no x coordinate present! How can the redisplay still work? display_line also makes the decisions when the screen line is full and the rest should be on the next screen line this is one of its most important roles. But you have removed that code, so you don't see it in what's left. The parts that deal with the X coordinate that exceeds last_visible_x are those which make that decision.