From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id EP6uH/rk0WI1xhMAWB0awg (envelope-from ) for ; Fri, 15 Jul 2022 18:06:50 -0400 Received: by simark.ca (Postfix, from userid 112) id 7E83B1E5EA; Fri, 15 Jul 2022 18:06:50 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, NICE_REPLY_A,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id C787E1E13B for ; Fri, 15 Jul 2022 18:06:49 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 822B73857BBF for ; Fri, 15 Jul 2022 22:06:49 +0000 (GMT) Received: from mail-lj1-f171.google.com (mail-lj1-f171.google.com [209.85.208.171]) by sourceware.org (Postfix) with ESMTPS id B2C8F3858D32 for ; Fri, 15 Jul 2022 22:06:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B2C8F3858D32 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=mail.api.win Authentication-Results: sourceware.org; spf=none smtp.mailfrom=api.win Received: by mail-lj1-f171.google.com with SMTP id o12so7119049ljc.3 for ; Fri, 15 Jul 2022 15:06:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=1d+ZIjfZBaiTOQImt8orPkPcWWesUXVpue3cj4hFNs4=; b=fdLHwEEq3sRxw9xubfovHdMJuxbWj6wQMrMXfw7jJLKpHpvZznMk5cowIu8p4ryxuF R0b4wZASTD7yQyU3/oSF2RWTaCwY/EmD0vAmM2e+TyKHD24B3uMdn+jZnCsmmf9o9+S6 Rg3w5fSvERiQ5V34KLyg3OCGPXDdGwdL5tS58EL1thUCrIyXEPUGDzJlBoAViRkhyr1U 8Ab1d7GweIpWVRty0nhAHTh/NT4dX7ftyi+x8jfknlXoP9F+WyyV2mMSpyisXUZqdDhb esXxzUYhLb6Wv/21Nm7uLRRXJDjWg9qCC6p5lroV7shoiBGOLjQdow7YE1m7c9WPz6rj yNPQ== X-Gm-Message-State: AJIora/dtK4Yj4muAluU43k0AQiuM97/9jHD8Laek7BFHwG7LlmHxZMK VJjahAGfdIlt2S9nX6YJQqjXnzk1t3vTlRWjhIg= X-Google-Smtp-Source: AGRyM1veVXYmbQ7CPk9k0AaAyqct7a/UDg3aS06dknwToeeKLtAJRcqjFyS45mYdBRh0o2ovOpfkww== X-Received: by 2002:a2e:312:0:b0:25b:dc9f:9e7e with SMTP id 18-20020a2e0312000000b0025bdc9f9e7emr7953541ljd.57.1657922796239; Fri, 15 Jul 2022 15:06:36 -0700 (PDT) Received: from ?IPV6:2a03:1ac0:b0d6:4d64:b8f2:538b:a7ad:11c2? ([2a03:1ac0:b0d6:4d64:b8f2:538b:a7ad:11c2]) by smtp.gmail.com with ESMTPSA id z5-20020a19f705000000b0048646c0af5csm1096636lfe.263.2022.07.15.15.06.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 15 Jul 2022 15:06:35 -0700 (PDT) Message-ID: Date: Sat, 16 Jul 2022 01:06:34 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH v2 (mentions of reverse mode eliminated)] Add style tui-cursorline command to colorize TUI current line. Content-Language: en-US To: Tom Tromey References: <83sfn91rvt.fsf@gnu.org> <20220710101003.4245-1-gdb@mail.api.win> <87tu7imafv.fsf@tromey.com> From: Andrei Pikas In-Reply-To: <87tu7imafv.fsf@tromey.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: gdb-patches@sourceware.org Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" > I think I'd prefer a hyphen in there, since "cursorline" isn't a word. > So, tui-cursor-line.  But why "cursor" and not "current"? "current > line" seems to be the term used in the gdb manual. I chose this name to match vim for those who familiar with :set cursorline. OK, I'll change it to tui-cursor-line. Or would you prefer tui-current-line? > Andrei> @@ -54,6 +54,28 @@ static const char * const cli_colors[] = { > Andrei>    "magenta", > Andrei>    "cyan", > Andrei>    "white", > Andrei> +  "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", > > What's this for? This is to support all 256 colors https://www.ditig.com/256-colors-cheat-sheet . I want to use the lightest shade of gray #255 for the background. > Andrei>      case '\n': > Andrei> +          if (wattr_get (w, &w_attrs, &w_pair, nullptr) == OK) > Andrei> +            /* Apply current style till the end of line. */ > Andrei> +            wchgat (w, -1, w_attrs, w_pair, nullptr); > > I don't think this is correct, because the source window may not extend > to the end of the line. I tested for long line. It doesn't seem to be a problem (screenshot https://drive.google.com/file/d/1lMgdR9cTNEQJAz05wO7TCgd3SVYOdXyP/view?usp=sharing ). I think -1 handles this case: "A character count of -1 or greater than the remaining window width means to change attributes all the way to the end of the current line." from https://linux.die.net/man/3/wchgat I can rewrite this line as wchgat (w, std::max (0, getmaxx (w) - getcurx (w)), w_attrs, w_pair, nullptr). But I think it's the same.