colorful-winsep.nvim icon indicating copy to clipboard operation
colorful-winsep.nvim copied to clipboard

[Enhancement] Enhance Vertical Split Visual Clarity with Distinct Active Window Borders

Open huangpufan opened this issue 10 months ago • 7 comments

Description

When using the plugin with a vertical split layout containing only two windows, it becomes difficult to discern which window is currently active because there is only a single dividing line between them. This can lead to confusion and inefficiency, as users might type or perform actions in the wrong window.

Expected Behavior

I would like to propose a feature where there is a more distinct visual cue to indicate the active window when only two windows are present in a vertical split layout.

Current Behavior

At present, the plugin indicates the active window in a vertically split view by lighting up only half of the dividing line: the upper half if the right window is active, and the lower half if the left window is active. While this does provide an indication of which window is focused, the signal is quite subtle and can be easily overlooked. image

Steps to Reproduce

  1. Open the plugin and create a vertical split layout with two windows.
  2. Click between windows to change the focus.
  3. Observe that there is no clear indication of which window is active, other than the cursor location.

Additional Information

This enhancement would greatly improve the user experience by making it easier to identify the active window at a glance, especially for users who frequently switch between only two vertical split windows.

Thank you for considering this feature request. I believe it would benefit many users of your plugin.

huangpufan avatar Mar 31 '24 02:03 huangpufan

I don't have any good ideas at the moment. Could you provide some guidance?

denstiny avatar Apr 03 '24 02:04 denstiny

I don't really have a good method to recommend either. How to label two vertically split windows largely depends on personal aesthetics.

Perhaps, using "」" for the left and "「" for the right, utilizing a bit more horizontal extension to mark the current window.

I haven't actually tested this method, so it might not be truly suitable.

huangpufan avatar Apr 04 '24 05:04 huangpufan

This sounds to be a very reasonable idea, just make the end piece of the separator line a corner that points towards the active pane. Or you could even make the separator span from side to side between the two panes and make both end a corner that points toward the active one.

v-tibi avatar May 08 '24 09:05 v-tibi

https://github.com/nvim-zh/colorful-winsep.nvim/assets/57088952/7ee96394-af0a-46ce-b23c-ae2905075611

@v-tibi @huangpufan

denstiny avatar May 20 '24 15:05 denstiny

Edit the config.light_pollution callback function, which passes the current dividing line

	light_pollution = function(lines)
		local v_smooth = 0
		local s_smooth = 0
		for dir, line in pairs(lines) do
			local timer = vim.uv.new_timer()
			local height = line:height()
			timer:start(
				1,
				50,
				vim.schedule_wrap(function()
					local status = true
					if line:is_show() and (dir == "h" or dir == "l") then
						if v_smooth ~= line:height() then
							status = false
							local symbol = line.body_symbol
							if v_smooth == 0 then
								symbol = line.start_symbol
							end
							if v_smooth + 1 == height then
								symbol = line.end_symbol
							end
							line:pos_color(v_smooth, 0, "Error", symbol)
							v_smooth = v_smooth + 1
						end
					end
					if status and not timer:is_closing() then
						timer:stop()
						timer:close()
					end
				end)
			)
			local timer2 = vim.uv.new_timer()
			local width = line:width()
			timer2:start(
				1,
				4,
				vim.schedule_wrap(function()
					local status = true
					if line:is_show() and (dir == "j" or dir == "k") then
						if s_smooth ~= line:width() * 3 then
							status = false
							local symbol = line.body_symbol
							if s_smooth == 0 then
								symbol = line.start_symbol
							end
							if s_smooth + 1 == width then
								symbol = line.end_symbol
							end
							line:pos_color(0, s_smooth, "Error", symbol)
							s_smooth = s_smooth + 1
						end
					end
					if status and not timer2:is_closing() then
						timer2:stop()
						timer2:close()
					end
				end)
			)
		end
	end,

denstiny avatar May 20 '24 15:05 denstiny

2024-05-20_23-03-33.mp4

@v-tibi @huangpufan

That is very cool but I don't see how it address this issue in particular.

I think you should be able to insert an indicator either on either end or the midpoint of the diving line. Idk how it would be implemented but imagine a config like:

indicator = {
  position = 'center', -- 'top', 'bot', 'topbot', 'all',
  symbols = {
    left = '',
    right = '',
    up = '',
    down = '',
  },
},

Rydwxz avatar May 20 '24 17:05 Rydwxz

2024-05-20_23-03-33.mp4 @v-tibi @huangpufan

这非常酷,但我不知道它是如何特别解决这个问题的。

我认为您应该能够在潜水线的两端或中点插入一个指示器。 我不知道它是如何实现的,但想象一下这样的配置:

indicator = {
  position = 'center', -- 'top', 'bot', 'topbot', 'all',
  symbols = {
    left = '',
    right = '',
    up = '',
    down = '',
  },
},
	light_pollution = function(lines)
		for dir, line in pairs(lines) do
			if line:is_show() and (dir == "h" or dir == "l") then
				if dir == "h" then
					line:pos_color(line:height() / 2, 0, "Error", ">")
				elseif dir == "l" then
					line:pos_color(line:height() / 2, 0, "Error", "<")
				end
			end
		end

denstiny avatar May 21 '24 11:05 denstiny