Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 3EA15431FD0 for ; Tue, 24 May 2011 15:43:43 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.699 X-Spam-Level: X-Spam-Status: No, score=-0.699 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id nQVbNVGEbvRs for ; Tue, 24 May 2011 15:43:42 -0700 (PDT) Received: from mail-qw0-f53.google.com (mail-qw0-f53.google.com [209.85.216.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 69A63431FB6 for ; Tue, 24 May 2011 15:43:42 -0700 (PDT) Received: by qwb7 with SMTP id 7so4391348qwb.26 for ; Tue, 24 May 2011 15:43:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=2E5PjNQH8lScfw3AUwhzBbT8Fu6K8Nw/Mei8pVdDYKU=; b=unfiBWTxau7/P4scLwh9Os+gzp1/5/9+hguaCqlZpf85bVCY6nL/hCMGIr+x55uks3 EM93VTeXcQfdZBnS1VwhVD1mzOVcqA4OrC1FfLCs5rZqAI5BxwX/eiTymji3PRDymYY3 ynYMdIe+KVBjGMRtBxt0fJ8P/jq4jxFfOIGYs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=X3RVP679XpZIaLb7DX+6ap6U+vNrcRQ6ZolEfsLlTGFsGRXy9XK+iIpO7z5NnPysot 9MLJbBN02AGALOn6TLPdpoDfNcFrSxCCwYcYro7FGLriEPabTUQZv0WnpPawyp3LdiIJ G8dDk8WESenpfxAk6pRGJpmqlnDOM0oFWvh84= MIME-Version: 1.0 Received: by 10.229.35.1 with SMTP id n1mr3320740qcd.84.1306277021477; Tue, 24 May 2011 15:43:41 -0700 (PDT) Sender: amdragon@gmail.com Received: by 10.229.188.68 with HTTP; Tue, 24 May 2011 15:43:41 -0700 (PDT) In-Reply-To: <871uznrbh5.fsf@gmail.com> References: <1306090675-26982-1-git-send-email-dmitry.kurochkin@gmail.com> <1306164587-20326-1-git-send-email-dmitry.kurochkin@gmail.com> <87oc2rlujb.fsf@yoom.home.cworth.org> <8762ozrfrr.fsf@gmail.com> <87oc2rvjvj.fsf@yoom.home.cworth.org> <871uznrbh5.fsf@gmail.com> Date: Tue, 24 May 2011 18:43:41 -0400 X-Google-Sender-Auth: Povl34JhrJyFEUrryhHXT61Kxgk Message-ID: Subject: Re: [PATCH] Save and restore point explicitly in `notmuch-wash-toggle-invisible-action'. From: Austin Clements To: Dmitry Kurochkin Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: notmuch@notmuchmail.org X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 May 2011 22:43:43 -0000 On Tue, May 24, 2011 at 6:16 PM, Dmitry Kurochkin wrote: > When a user clicks the button, the cursor is somewhere inside the old > label. =A0If we save the point as a marker, after step 3 it would end up > at the position where the old label was. =A0If the new label is inserted > before the old one, that means after the new label. =A0So the cursor jump= s > from inside the button to the position after the button. =A0Since the new > button is placed at the same position where the old one was, restoring > the point to the same offset it was at the beginning works as we need. Saving point this way is a bit dangerous, though. For example, if you're near the end of the buffer and shorten the label, attempting to restore the point could result in an error (or, a more benign example: the cursor could wind up outside the label so pressing RET repeatedly won't toggle it). Unfortunately, I don't know of a clean solution to this, but I think I would rather the cursor move, but stay within the label (probably moving to the beginning), than have problems like the above.