{"action":"created","comment":{"url":"https://api.github.com/repos/jaredpar/VsVim/pulls/comments/212673998","pull_request_review_id":149360189,"id":212673998,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxMjY3Mzk5OA==","diff_hunk":"@@ -682,12 +688,43 @@ type internal VimBuffer\n \r\n     /// Switch to the desired mode\r\n     member x.SwitchMode modeKind modeArgument =\r\n-        _modeMap.SwitchMode modeKind modeArgument\r\n+        // Some mode switches can implicitly modify or be modified by the current one command mode\r\n+        let overrideModeKind =\r\n+            if VimExtensions.IsAnyInsert modeKind then\r\n+                // switches to an insert mode end one command mode\r\n+                _inSelectModeOneCommand <- false\r\n+                _vimTextBuffer.InOneTimeCommand <- None\r\n+                modeKind\r\n+            elif VisualKind.IsAnyVisualOrSelect modeKind then\r\n+                // Switching from an insert mode to a visual/select mode automatically initiates one command mode\r\n+                if VimExtensions.IsAnyInsert x.Mode.ModeKind then\r\n+                    _inSelectModeOneCommand <- false\r\n+                    _vimTextBuffer.InOneTimeCommand <- Some x.Mode.ModeKind\r\n+                modeKind\r\n+            elif modeKind = ModeKind.Normal then\r\n+                match _vimTextBuffer.InOneTimeCommand with\r\n+                | Some oneTimeModeKind ->\r\n+                    _inSelectModeOneCommand <- false\r\n+                    _vimTextBuffer.InOneTimeCommand <- None\r\n+                    oneTimeModeKind\r\n+                | None ->\r\n+                    modeKind\r\n+            else\r\n+                modeKind\r\n+        \r\n+        _modeMap.SwitchMode overrideModeKind modeArgument\r","path":"Src/VimCore/VimBuffer.fs","position":110,"original_position":110,"commit_id":"fc3ccda20f6fa884fc7deb9ef31599ffa913a253","original_commit_id":"fc3ccda20f6fa884fc7deb9ef31599ffa913a253","user":{"login":"jaredpar","id":146967,"node_id":"MDQ6VXNlcjE0Njk2Nw==","avatar_url":"https://avatars0.githubusercontent.com/u/146967?v=4","gravatar_id":"","url":"https://api.github.com/users/jaredpar","html_url":"https://github.com/jaredpar","followers_url":"https://api.github.com/users/jaredpar/followers","following_url":"https://api.github.com/users/jaredpar/following{/other_user}","gists_url":"https://api.github.com/users/jaredpar/gists{/gist_id}","starred_url":"https://api.github.com/users/jaredpar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaredpar/subscriptions","organizations_url":"https://api.github.com/users/jaredpar/orgs","repos_url":"https://api.github.com/users/jaredpar/repos","events_url":"https://api.github.com/users/jaredpar/events{/privacy}","received_events_url":"https://api.github.com/users/jaredpar/received_events","type":"User","site_admin":false},"body":"This logic feels like it's in the wrong place. The implementation of `SwitchMode` should be pretty much what it is today: switch to the mode that is provided. Logic around taking a desired mode and changing it based on the current state should be at a higher layer. ","created_at":"2018-08-24T15:52:36Z","updated_at":"2018-08-24T15:52:36Z","html_url":"https://github.com/jaredpar/VsVim/pull/2347#discussion_r212673998","pull_request_url":"https://api.github.com/repos/jaredpar/VsVim/pulls/2347","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/jaredpar/VsVim/pulls/comments/212673998"},"html":{"href":"https://github.com/jaredpar/VsVim/pull/2347#discussion_r212673998"},"pull_request":{"href":"https://api.github.com/repos/jaredpar/VsVim/pulls/2347"}}},"pull_request":{"url":"https://api.github.com/repos/jaredpar/VsVim/pulls/2347","id":210555511,"node_id":"MDExOlB1bGxSZXF1ZXN0MjEwNTU1NTEx","html_url":"https://github.com/jaredpar/VsVim/pull/2347","diff_url":"https://github.com/jaredpar/VsVim/pull/2347.diff","patch_url":"https://github.com/jaredpar/VsVim/pull/2347.patch","issue_url":"https://api.github.com/repos/jaredpar/VsVim/issues/2347","number":2347,"state":"open","locked":false,"title":"fixes for one-commmand mode switching and display","user":{"login":"dhmgit","id":3457284,"node_id":"MDQ6VXNlcjM0NTcyODQ=","avatar_url":"https://avatars2.githubusercontent.com/u/3457284?v=4","gravatar_id":"","url":"https://api.github.com/users/dhmgit","html_url":"https://github.com/dhmgit","followers_url":"https://api.github.com/users/dhmgit/followers","following_url":"https://api.github.com/users/dhmgit/following{/other_user}","gists_url":"https://api.github.com/users/dhmgit/gists{/gist_id}","starred_url":"https://api.github.com/users/dhmgit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dhmgit/subscriptions","organizations_url":"https://api.github.com/users/dhmgit/orgs","repos_url":"https://api.github.com/users/dhmgit/repos","events_url":"https://api.github.com/users/dhmgit/events{/privacy}","received_events_url":"https://api.github.com/users/dhmgit/received_events","type":"User","site_admin":false},"body":"Fixes #2346 \r\n\r\nThis is the most \"invasive\" change I've made so far in this codebase, so I expect a fair amount of scrutiny.  The biggest challenge is to deal with the very large number of code paths that can lead to a mode switch without resorting to adding a lot of special case logic, or modifying the mode-specific code.  The more I experimented with gVim, the more I was surprised by features (or \"features\") that I didn't know existed.  Hopefully, I've hit all or nearly all of them.","created_at":"2018-08-23T19:43:43Z","updated_at":"2018-08-24T15:52:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3a399e3fde9ddd76c02a1fdb3fdad03788cb6e3a","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/jaredpar/VsVim/pulls/2347/commits","review_comments_url":"https://api.github.com/repos/jaredpar/VsVim/pulls/2347/comments","review_comment_url":"https://api.github.com/repos/jaredpar/VsVim/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jaredpar/VsVim/issues/2347/comments","statuses_url":"https://api.github.com/repos/jaredpar/VsVim/statuses/fc3ccda20f6fa884fc7deb9ef31599ffa913a253","head":{"label":"dhmgit:fix-one-command","ref":"fix-one-command","sha":"fc3ccda20f6fa884fc7deb9ef31599ffa913a253","user":{"login":"dhmgit","id":3457284,"node_id":"MDQ6VXNlcjM0NTcyODQ=","avatar_url":"https://avatars2.githubusercontent.com/u/3457284?v=4","gravatar_id":"","url":"https://api.github.com/users/dhmgit","html_url":"https://github.com/dhmgit","followers_url":"https://api.github.com/users/dhmgit/followers","following_url":"https://api.github.com/users/dhmgit/following{/other_user}","gists_url":"https://api.github.com/users/dhmgit/gists{/gist_id}","starred_url":"https://api.github.com/users/dhmgit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dhmgit/subscriptions","organizations_url":"https://api.github.com/users/dhmgit/orgs","repos_url":"https://api.github.com/users/dhmgit/repos","events_url":"https://api.github.com/users/dhmgit/events{/privacy}","received_events_url":"https://api.github.com/users/dhmgit/received_events","type":"User","site_admin":false},"repo":{"id":136043243,"node_id":"MDEwOlJlcG9zaXRvcnkxMzYwNDMyNDM=","name":"VsVim","full_name":"dhmgit/VsVim","owner":{"login":"dhmgit","id":3457284,"node_id":"MDQ6VXNlcjM0NTcyODQ=","avatar_url":"https://avatars2.githubusercontent.com/u/3457284?v=4","gravatar_id":"","url":"https://api.github.com/users/dhmgit","html_url":"https://github.com/dhmgit","followers_url":"https://api.github.com/users/dhmgit/followers","following_url":"https://api.github.com/users/dhmgit/following{/other_user}","gists_url":"https://api.github.com/users/dhmgit/gists{/gist_id}","starred_url":"https://api.github.com/users/dhmgit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dhmgit/subscriptions","organizations_url":"https://api.github.com/users/dhmgit/orgs","repos_url":"https://api.github.com/users/dhmgit/repos","events_url":"https://api.github.com/users/dhmgit/events{/privacy}","received_events_url":"https://api.github.com/users/dhmgit/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dhmgit/VsVim","description":"Vim Emulator Plugin for Visual Studio 2012+ ","fork":true,"url":"https://api.github.com/repos/dhmgit/VsVim","forks_url":"https://api.github.com/repos/dhmgit/VsVim/forks","keys_url":"https://api.github.com/repos/dhmgit/VsVim/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dhmgit/VsVim/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dhmgit/VsVim/teams","hooks_url":"https://api.github.com/repos/dhmgit/VsVim/hooks","issue_events_url":"https://api.github.com/repos/dhmgit/VsVim/issues/events{/number}","events_url":"https://api.github.com/repos/dhmgit/VsVim/events","assignees_url":"https://api.github.com/repos/dhmgit/VsVim/assignees{/user}","branches_url":"https://api.github.com/repos/dhmgit/VsVim/branches{/branch}","tags_url":"https://api.github.com/repos/dhmgit/VsVim/tags","blobs_url":"https://api.github.com/repos/dhmgit/VsVim/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dhmgit/VsVim/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dhmgit/VsVim/git/refs{/sha}","trees_url":"https://api.github.com/repos/dhmgit/VsVim/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dhmgit/VsVim/statuses/{sha}","languages_url":"https://api.github.com/repos/dhmgit/VsVim/languages","stargazers_url":"https://api.github.com/repos/dhmgit/VsVim/stargazers","contributors_url":"https://api.github.com/repos/dhmgit/VsVim/contributors","subscribers_url":"https://api.github.com/repos/dhmgit/VsVim/subscribers","subscription_url":"https://api.github.com/repos/dhmgit/VsVim/subscription","commits_url":"https://api.github.com/repos/dhmgit/VsVim/commits{/sha}","git_commits_url":"https://api.github.com/repos/dhmgit/VsVim/git/commits{/sha}","comments_url":"https://api.github.com/repos/dhmgit/VsVim/comments{/number}","issue_comment_url":"https://api.github.com/repos/dhmgit/VsVim/issues/comments{/number}","contents_url":"https://api.github.com/repos/dhmgit/VsVim/contents/{+path}","compare_url":"https://api.github.com/repos/dhmgit/VsVim/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dhmgit/VsVim/merges","archive_url":"https://api.github.com/repos/dhmgit/VsVim/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dhmgit/VsVim/downloads","issues_url":"https://api.github.com/repos/dhmgit/VsVim/issues{/number}","pulls_url":"https://api.github.com/repos/dhmgit/VsVim/pulls{/number}","milestones_url":"https://api.github.com/repos/dhmgit/VsVim/milestones{/number}","notifications_url":"https://api.github.com/repos/dhmgit/VsVim/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dhmgit/VsVim/labels{/name}","releases_url":"https://api.github.com/repos/dhmgit/VsVim/releases{/id}","deployments_url":"https://api.github.com/repos/dhmgit/VsVim/deployments","created_at":"2018-06-04T15:10:50Z","updated_at":"2018-08-23T12:46:37Z","pushed_at":"2018-08-23T19:57:13Z","git_url":"git://github.com/dhmgit/VsVim.git","ssh_url":"git@github.com:dhmgit/VsVim.git","clone_url":"https://github.com/dhmgit/VsVim.git","svn_url":"https://github.com/dhmgit/VsVim","homepage":"","size":47527,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"jaredpar:master","ref":"master","sha":"64a92f3f5cc920d5b5b13db914d4d8a76c279fb4","user":{"login":"jaredpar","id":146967,"node_id":"MDQ6VXNlcjE0Njk2Nw==","avatar_url":"https://avatars0.githubusercontent.com/u/146967?v=4","gravatar_id":"","url":"https://api.github.com/users/jaredpar","html_url":"https://github.com/jaredpar","followers_url":"https://api.github.com/users/jaredpar/followers","following_url":"https://api.github.com/users/jaredpar/following{/other_user}","gists_url":"https://api.github.com/users/jaredpar/gists{/gist_id}","starred_url":"https://api.github.com/users/jaredpar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaredpar/subscriptions","organizations_url":"https://api.github.com/users/jaredpar/orgs","repos_url":"https://api.github.com/users/jaredpar/repos","events_url":"https://api.github.com/users/jaredpar/events{/privacy}","received_events_url":"https://api.github.com/users/jaredpar/received_events","type":"User","site_admin":false},"repo":{"id":388860,"node_id":"MDEwOlJlcG9zaXRvcnkzODg4NjA=","name":"VsVim","full_name":"jaredpar/VsVim","owner":{"login":"jaredpar","id":146967,"node_id":"MDQ6VXNlcjE0Njk2Nw==","avatar_url":"https://avatars0.githubusercontent.com/u/146967?v=4","gravatar_id":"","url":"https://api.github.com/users/jaredpar","html_url":"https://github.com/jaredpar","followers_url":"https://api.github.com/users/jaredpar/followers","following_url":"https://api.github.com/users/jaredpar/following{/other_user}","gists_url":"https://api.github.com/users/jaredpar/gists{/gist_id}","starred_url":"https://api.github.com/users/jaredpar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaredpar/subscriptions","organizations_url":"https://api.github.com/users/jaredpar/orgs","repos_url":"https://api.github.com/users/jaredpar/repos","events_url":"https://api.github.com/users/jaredpar/events{/privacy}","received_events_url":"https://api.github.com/users/jaredpar/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jaredpar/VsVim","description":"Vim Emulator Plugin for Visual Studio 2012+ ","fork":false,"url":"https://api.github.com/repos/jaredpar/VsVim","forks_url":"https://api.github.com/repos/jaredpar/VsVim/forks","keys_url":"https://api.github.com/repos/jaredpar/VsVim/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jaredpar/VsVim/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jaredpar/VsVim/teams","hooks_url":"https://api.github.com/repos/jaredpar/VsVim/hooks","issue_events_url":"https://api.github.com/repos/jaredpar/VsVim/issues/events{/number}","events_url":"https://api.github.com/repos/jaredpar/VsVim/events","assignees_url":"https://api.github.com/repos/jaredpar/VsVim/assignees{/user}","branches_url":"https://api.github.com/repos/jaredpar/VsVim/branches{/branch}","tags_url":"https://api.github.com/repos/jaredpar/VsVim/tags","blobs_url":"https://api.github.com/repos/jaredpar/VsVim/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jaredpar/VsVim/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jaredpar/VsVim/git/refs{/sha}","trees_url":"https://api.github.com/repos/jaredpar/VsVim/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jaredpar/VsVim/statuses/{sha}","languages_url":"https://api.github.com/repos/jaredpar/VsVim/languages","stargazers_url":"https://api.github.com/repos/jaredpar/VsVim/stargazers","contributors_url":"https://api.github.com/repos/jaredpar/VsVim/contributors","subscribers_url":"https://api.github.com/repos/jaredpar/VsVim/subscribers","subscription_url":"https://api.github.com/repos/jaredpar/VsVim/subscription","commits_url":"https://api.github.com/repos/jaredpar/VsVim/commits{/sha}","git_commits_url":"https://api.github.com/repos/jaredpar/VsVim/git/commits{/sha}","comments_url":"https://api.github.com/repos/jaredpar/VsVim/comments{/number}","issue_comment_url":"https://api.github.com/repos/jaredpar/VsVim/issues/comments{/number}","contents_url":"https://api.github.com/repos/jaredpar/VsVim/contents/{+path}","compare_url":"https://api.github.com/repos/jaredpar/VsVim/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jaredpar/VsVim/merges","archive_url":"https://api.github.com/repos/jaredpar/VsVim/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jaredpar/VsVim/downloads","issues_url":"https://api.github.com/repos/jaredpar/VsVim/issues{/number}","pulls_url":"https://api.github.com/repos/jaredpar/VsVim/pulls{/number}","milestones_url":"https://api.github.com/repos/jaredpar/VsVim/milestones{/number}","notifications_url":"https://api.github.com/repos/jaredpar/VsVim/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jaredpar/VsVim/labels{/name}","releases_url":"https://api.github.com/repos/jaredpar/VsVim/releases{/id}","deployments_url":"https://api.github.com/repos/jaredpar/VsVim/deployments","created_at":"2009-11-29T01:59:00Z","updated_at":"2018-08-23T15:18:27Z","pushed_at":"2018-08-24T05:57:32Z","git_url":"git://github.com/jaredpar/VsVim.git","ssh_url":"git@github.com:jaredpar/VsVim.git","clone_url":"https://github.com/jaredpar/VsVim.git","svn_url":"https://github.com/jaredpar/VsVim","homepage":"","size":47631,"stargazers_count":2619,"watchers_count":2619,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":337,"mirror_url":null,"archived":false,"open_issues_count":166,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":337,"open_issues":166,"watchers":2619,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jaredpar/VsVim/pulls/2347"},"html":{"href":"https://github.com/jaredpar/VsVim/pull/2347"},"issue":{"href":"https://api.github.com/repos/jaredpar/VsVim/issues/2347"},"comments":{"href":"https://api.github.com/repos/jaredpar/VsVim/issues/2347/comments"},"review_comments":{"href":"https://api.github.com/repos/jaredpar/VsVim/pulls/2347/comments"},"review_comment":{"href":"https://api.github.com/repos/jaredpar/VsVim/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jaredpar/VsVim/pulls/2347/commits"},"statuses":{"href":"https://api.github.com/repos/jaredpar/VsVim/statuses/fc3ccda20f6fa884fc7deb9ef31599ffa913a253"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"jaredpar"}}