{"action":"created","issue":{"url":"https://api.github.com/repos/kovidgoyal/kitty/issues/1000","repository_url":"https://api.github.com/repos/kovidgoyal/kitty","labels_url":"https://api.github.com/repos/kovidgoyal/kitty/issues/1000/labels{/name}","comments_url":"https://api.github.com/repos/kovidgoyal/kitty/issues/1000/comments","events_url":"https://api.github.com/repos/kovidgoyal/kitty/issues/1000/events","html_url":"https://github.com/kovidgoyal/kitty/issues/1000","id":362398795,"node_id":"MDU6SXNzdWUzNjIzOTg3OTU=","number":1000,"title":"ibus input woes: bad pre-edit text position after commit","user":{"login":"martinetd","id":1729331,"node_id":"MDQ6VXNlcjE3MjkzMzE=","avatar_url":"https://avatars0.githubusercontent.com/u/1729331?v=4","gravatar_id":"","url":"https://api.github.com/users/martinetd","html_url":"https://github.com/martinetd","followers_url":"https://api.github.com/users/martinetd/followers","following_url":"https://api.github.com/users/martinetd/following{/other_user}","gists_url":"https://api.github.com/users/martinetd/gists{/gist_id}","starred_url":"https://api.github.com/users/martinetd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/martinetd/subscriptions","organizations_url":"https://api.github.com/users/martinetd/orgs","repos_url":"https://api.github.com/users/martinetd/repos","events_url":"https://api.github.com/users/martinetd/events{/privacy}","received_events_url":"https://api.github.com/users/martinetd/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-09-20T23:03:30Z","updated_at":"2018-09-21T04:11:01Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"As you're aware there are a few problems with the ibus input, but unfortunately I kind of need it for Japanese (no, compose really doesn't cut it ;))\r\n\r\nI've sent a PR for the first problem that really annoyed me as it was happening quite often, but I have another problem closer to kitty you might be of good advice for.\r\nBasically, the pre-edit text position can be positioned wrongly if it's open immediately after a commit - e.g. since the commit only schedules a write, if by the time the next key is typed the write hasn't happened yet, the preedit text will be displayed first where the cursor was before the commit and then the previously-committed text will be displayed after the preedit overlay.　From there on things get quite ugly :)\r\n\r\nI think the simplest fix to that would be to delay the displaying of the ime pre-edit overlay until the schedule write is over; we can still process text input and send it to ibus etc but just not display it until we know where to place ourselves?\r\nIdeally it would be better to display the window in the right place but I don't think that's quite possible; we *could* try to display the preedit text where the cursor is then on the actual committed text write notice there is a pre-edit window and write over it then redisplay the pre-edit window but I'm afraid that would flicker and think it's best to just delay the display rather than flickering.\r\n\r\n\r\nWhat do you think?\r\n\r\nImplementation-wise I'm not sure, an easy way out would be to call `write_to_child` ourselves in/before `update_ime_position` but then that won't continue processing input like I said we would; we need to check if there is pending data and if there is mark the ime overlay \"to be displayed\" somehow, and let the io loop handle that...?"},"comment":{"url":"https://api.github.com/repos/kovidgoyal/kitty/issues/comments/423407689","html_url":"https://github.com/kovidgoyal/kitty/issues/1000#issuecomment-423407689","issue_url":"https://api.github.com/repos/kovidgoyal/kitty/issues/1000","id":423407689,"node_id":"MDEyOklzc3VlQ29tbWVudDQyMzQwNzY4OQ==","user":{"login":"kovidgoyal","id":1308621,"node_id":"MDQ6VXNlcjEzMDg2MjE=","avatar_url":"https://avatars0.githubusercontent.com/u/1308621?v=4","gravatar_id":"","url":"https://api.github.com/users/kovidgoyal","html_url":"https://github.com/kovidgoyal","followers_url":"https://api.github.com/users/kovidgoyal/followers","following_url":"https://api.github.com/users/kovidgoyal/following{/other_user}","gists_url":"https://api.github.com/users/kovidgoyal/gists{/gist_id}","starred_url":"https://api.github.com/users/kovidgoyal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kovidgoyal/subscriptions","organizations_url":"https://api.github.com/users/kovidgoyal/orgs","repos_url":"https://api.github.com/users/kovidgoyal/repos","events_url":"https://api.github.com/users/kovidgoyal/events{/privacy}","received_events_url":"https://api.github.com/users/kovidgoyal/received_events","type":"User","site_admin":false},"created_at":"2018-09-21T04:11:01Z","updated_at":"2018-09-21T04:11:01Z","author_association":"OWNER","body":"If I understand the issue correctly, I dont think this is solvable. This is because writing to the child is fundamentally asynchronous. Just because kitty finishes the write_to_child does not mean the kernel has actually written to the child and the cursor movement/text echoing bytes have been received by the input side of the tty. Basically there is no way that I know of to guarantee that the result of a previous commit will not appear in the middle of the next pre-edit. \r\n\r\nBut maybe I am misunderstanding something.\r\n"}}
{"actor":{"display_login":"kovidgoyal"}}