Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
huangpufan opened this issue Mar 31, 2024 · 7 comments

Comments

@huangpufan
Copy link

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.

@denstiny
Copy link
Collaborator

denstiny commented Apr 3, 2024

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

@huangpufan
Copy link
Author

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.

@v-tibi
Copy link

v-tibi commented May 8, 2024

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.

@denstiny
Copy link
Collaborator

denstiny commented May 20, 2024

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

@v-tibi @huangpufan

@denstiny
Copy link
Collaborator

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,

@Rydwxz
Copy link

Rydwxz commented May 20, 2024

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 = '',
  },
},

@denstiny
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants