From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: "otadmor ." Newsgroups: gmane.emacs.help Subject: Re: Overlay after-string with cursor (Stefan Monnier) Date: Mon, 12 Aug 2019 01:59:51 +0300 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="100424"; mail-complaints-to="usenet@blaine.gmane.org" Cc: help-gnu-emacs@gnu.org To: Stefan Monnier Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Aug 12 01:00:15 2019 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hwwow-000PzO-Qu for geh-help-gnu-emacs@m.gmane.org; Mon, 12 Aug 2019 01:00:14 +0200 Original-Received: from localhost ([::1]:42066 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hwwov-0004nL-7d for geh-help-gnu-emacs@m.gmane.org; Sun, 11 Aug 2019 19:00:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39142) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hwwoo-0004nD-6H for help-gnu-emacs@gnu.org; Sun, 11 Aug 2019 19:00:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hwwom-0003un-VO for help-gnu-emacs@gnu.org; Sun, 11 Aug 2019 19:00:06 -0400 Original-Received: from mail-lf1-x136.google.com ([2a00:1450:4864:20::136]:43727) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hwwom-0003uI-Kh for help-gnu-emacs@gnu.org; Sun, 11 Aug 2019 19:00:04 -0400 Original-Received: by mail-lf1-x136.google.com with SMTP id c19so73063598lfm.10 for ; Sun, 11 Aug 2019 16:00:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=lJxrZl3fahZ3rcRfrcYtbWBUEfUaighXEy9dJrRz7Pc=; b=KlH8aDtVlhA0zHnRjyLrF6qTLWW/A8OhrcuGDYPeyt1hYtpM4geHJzDiLzDqLRQwkm vyea0R/d32NshDWdrD9xgPynPit4Q8qu03kjJMvjAgvCRxm1Ug6GLu9i+AODvAy8SdGb EL8oKNasH1Ta07v5RYp7BE+p10ptz4ylqGhTyK4VQJbF3k445f029tfP1LSy8lzYZvjV W1Y9PMcsvHoTFVGicf8JDfIs5r5W/aFylwppQvzeo9oRNSM93l7Zi98GyJaPX/UUgAgP hcWCPWnrDijo8DRFmO2hRx2Y6FBEJpWVrJ+3P5/bRVLgOnUAx4/kqIk6u8sZ7jQ31Uqb tQdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=lJxrZl3fahZ3rcRfrcYtbWBUEfUaighXEy9dJrRz7Pc=; b=FdoGEAppnPmsct1ilXdMbl5UoGC5dAkdX0bfKm0ySN05ZoEhDzZYVp9scO1UAeeq7v t31DDNt0wTwl/kMOBLh9mcw3gL/EnNcWjthdJ4UdnlGzghdrJrTKLpI1y/B+r/i0RZiK r5y7dVQLILO8qTrLgPdtiVkI1cbYWGXMiLB5i1qDl+upmqIoA5X6GBskSrxhJBOpoY/3 N/piWw60VZ3tIU9K/RD1ehBZsVN3VqBifpe0SXf0bVigpT3L1519J990TrVMw2OL0Eqt yBJt4IJ96GA5kKILwezZO4OalKrwo4HJouXq94HvzTZXTVG1KQZ98DPcYX7IwXWZ5t7O 7uQA== X-Gm-Message-State: APjAAAXoZ8nynL2MqwNnUqhBqqDo1s+eWJx2LYKsV3vQK7Drm2/mHdv3 1yb1JWkAhQV1CBql/AsBrFDkqVC3xqfE07BORZg= X-Google-Smtp-Source: APXvYqyYmsrP/qpqjXZ3wGPvc1k14s8d6q5/swEtISrecDMpLL5zKnHi8mdqYx4Ls5V/uyDBCKv0hHdPbe7IjoZwzbw= X-Received: by 2002:a19:e04f:: with SMTP id g15mr18809123lfj.46.1565564403090; Sun, 11 Aug 2019 16:00:03 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::136 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:121331 Archived-At: On Mon, Aug 12, 2019 at 1:32 AM Stefan Monnier wrote: > > >> You can control where the cursor is displayed in the after-string, with > >> the `cursor` property. Doing in it such a way that it gives the > >> illusion that you can put the cursor "wherever you want" can be a bit > >> fiddly > > As I understand, setting the cursor property allows me to put the > > cursor only in one position inside my overlay. > > AFAIK the cursor is never at two places at the same time, so that's not > a problem. I might not understand the purpose of the 'cursor property. As I understood it allows to put the cursor in a fixed position inside the overlay. I want the user to use the arrow keys to move it inside the overlay. > > > I want the user to be able to move the cursor inside the overlay when > > using the after-string property. > > You can, by changing the `cursor` property whenever you want the cursor > to change position. Do I have to re-bind the key map of the overlay so it would accept the arrow keys and change the 'cursor property accordingly? It would be hard because this would not support, for example, page up from outside the overlay into the overlay. Should I do these calculations manually? > > >> so I think it's worth clarifying why exactly you want something > >> like that, so as to be better decide how to attack the problem. > > Im trying to implement something visually similar to what vimdiff has, > > as in this URL: > > https://www.thegeekstuff.com/2010/06/vimdiff-file-diff-tool/ > > In there, you can see the lines filled with "....................." > > where there is no content in the line of the first file and there is > > content in the matching line in the second file. > > Hope this makes it clearer and that I managed to reply this thread correctly. > > That doesn't explain why you care about the cursor positioning in those > spaces that don't correspond to any real line, so I'm afraid it doesn't > make it clearer :-( > Generally it is easier for me (and other people I know) to understand diffs when the lines in the files are "aligned" to each other. As the diff become bigger there are more added spaces (empty lines), and the more spaces it is harder to navigate inside the files diff. Using the arrow keys makes the navigation easier. currently I have synchronized both buffers (side A and side B, C and ancestor) to received the arrow keys presses on the "ediff help buffer" (I have created a new "ediff-operate-on-windows" to support this). The problem is that when using the after-string (or display) property the cursor is stuck in one location in the overlay and doesnt move inside it. The synchronization is not working because of it. I though of a different solution than using the after string. I can really add the new empty lines into the buffer where there are diffs, but this creates other issues when this buffer is saved or shown on a different window. If only I was able to show a text in a buffer only in one window this could also solve the problem (and actually treading this as a text, unlike after-string). Adding the new lines the the buffer solves the navigation problems. > > Stefan > -- Gretz, Ofir Tadmor ICQ: 77685691 Mail: otadmor@gmail.com