You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Clicking a prompt line with no input shouldn’t move the cursor to the start of the input #11462
I'm using starship prompt for the terminal, it shows a whole line for the prompt, e.g.
{username} {cwd} // prompt line
> ls -lah // input
When I click on the prompt line, it moves the cursor to the beginning of the input. IMO, if the prompt line and input are at the same row, clicking on the prompt area should move the cursor to the start of the input. But if the prompt line is a separate line, it doesn't make sense to move the cursor to the beginning. One example, sometimes I double click on the prompt area to copy some text, then press cmd+v to paste to the end of current input line.
Screen.Recording.2026-03-12.at.10.09.07.PM.mov
Proposal
When the prompt area isn't in the same line as the input line, clicking the prompt area shouldn't move the cursor
[Current behavior] When the prompt area is in the same line as the input line, clicking the prompt area moves the cursor
Why do you want to make this change?
It prevents unexpectedly moving the cursor to the start of the input line when clicking on a dedicated prompt line.
I acknowledge that:
I have read the Contributing Guide and understand the contribution process.
I want to be specific that this should only be true for clicking on purely a prompt line. If a prompt line contains any input area, then we should still process prompt clicks.
Hey @hlcfan still catching up on how the code around your changes work but I tested this and I want to know if this is the behavior we want.
When we click on a word in the prompt area the fix behaves properly but when we click in the empty space of the prompt line the cursor still goes to the beginning. Is that space still "prompt area" because if it is then we're breaking the proposal requisite
When the prompt area isn't in the same line as the input line, clicking the prompt area shouldn't move the cursor
Hi @jesusvazquez You're right, I should've checked the click pin's row.semantic_prompt instead of the cell.semantic_content. Can you pull the latest changes from the branch and build it?
I only have a one comment on this. I see rowAndCell() is called before the loop and right when it starts. This can be optimized. The first iteration of the loop could reuse click_rac.
Right I think there is a tiny small imporvement over the existing code but I don't want us to do a full review in the issue. I was trying to help get your code function as stated in the issue and i think we're there now. Now you'd need to be vouched if you are not yet and then open a PR and we can do the rest of the improvements there.
That being siad click_rac is now a var so it leaks after the loop. You can do the following instead:
Make the click row a const
Keep an inner var for the row and cell which is the thing that you loop through.
constclick_row=click_pin.rowAndCell().row;
if (click_row.semantic_prompt!=.none) {
varrow_pin=click_pin;
prompt: while (true) {
constrac=row_pin.rowAndCell();
constcells=row_pin.node.data.getCells(rac.row);
for (cells) |cell| {
if (cell.semantic_content==.input) break :prompt;
}
if (!rac.row.wrap) return.zero;
row_pin=row_pin.down(1) orelsereturn.zero;
}
}
Activity
mitchellh commentedon Mar 13, 2026
I want to be specific that this should only be true for clicking on purely a prompt line. If a prompt line contains any input area, then we should still process prompt clicks.
hlcfan commentedon Mar 15, 2026
I made some changes https://github.com/ghostty-org/ghostty/compare/main...hlcfan:ghostty:prompt-click-cursor-movement?expand=1 here, lemme know if this is good.
jesusvazquez commentedon Mar 17, 2026
Hey @hlcfan still catching up on how the code around your changes work but I tested this and I want to know if this is the behavior we want.
When we click on a word in the prompt area the fix behaves properly but when we click in the empty space of the prompt line the cursor still goes to the beginning. Is that space still "prompt area" because if it is then we're breaking the proposal requisite
trimmed.mov
hlcfan commentedon Mar 17, 2026
Hi @jesusvazquez You're right, I should've checked the click pin's
row.semantic_promptinstead of thecell.semantic_content. Can you pull the latest changes from the branch and build it?Screen.Recording.2026-03-17.at.10.52.31.PM.mov
jesusvazquez commentedon Mar 17, 2026
I tested again and that works perfectly for me 👍
I only have a one comment on this. I see rowAndCell() is called before the loop and right when it starts. This can be optimized. The first iteration of the loop could reuse
click_rac.hlcfan commentedon Mar 18, 2026
Removed the extra method call, thanks! @jesusvazquez
jesusvazquez commentedon Mar 18, 2026
Right I think there is a tiny small imporvement over the existing code but I don't want us to do a full review in the issue. I was trying to help get your code function as stated in the issue and i think we're there now. Now you'd need to be vouched if you are not yet and then open a PR and we can do the rest of the improvements there.
That being siad
click_racis now a var so it leaks after the loop. You can do the following instead:hlcfan commentedon Mar 20, 2026
@mitchellh Please advise how to get a vouch from #11420.
mitchellh commentedon Mar 20, 2026
Oh my mistake, I misread the category. Vouching you now.
sielaq commentedon May 7, 2026
Any news on this? this is getting super annoying.
Any copy / paste inside terminal causing cursor jumps :(
rbelando commentedon Jun 12, 2026
divijg19 commentedon Aug 17, 2026
Hi folks- any updates or status checks on this issue and PR?
sergiocharpineljr commentedon Aug 26, 2026
Looks like this was already fixed. I can't reproduce it anymore in v1.3.1
hlcfan commentedon Aug 26, 2026
I'm able to reproduce from https://github.com/ghostty-org/ghostty/commits/5f5b988c5 nightly build.
rgoya commentedon Sep 18, 2026
Should it though?
I use a one line prompt, and this exact thing still bites me every so often.
rishangbhavsar commentedon Oct 12, 2026
Any updates for 1.3.2?