{"action":"created","issue":{"url":"https://api.github.com/repos/jsleroy/compare-plugin/issues/22","repository_url":"https://api.github.com/repos/jsleroy/compare-plugin","labels_url":"https://api.github.com/repos/jsleroy/compare-plugin/issues/22/labels{/name}","comments_url":"https://api.github.com/repos/jsleroy/compare-plugin/issues/22/comments","events_url":"https://api.github.com/repos/jsleroy/compare-plugin/issues/22/events","html_url":"https://github.com/jsleroy/compare-plugin/issues/22","id":167173089,"number":22,"title":"Compare current and previous files and place current in the top view","user":{"login":"jsleroy","id":88853,"avatar_url":"https://avatars.githubusercontent.com/u/88853?v=3","gravatar_id":"","url":"https://api.github.com/users/jsleroy","html_url":"https://github.com/jsleroy","followers_url":"https://api.github.com/users/jsleroy/followers","following_url":"https://api.github.com/users/jsleroy/following{/other_user}","gists_url":"https://api.github.com/users/jsleroy/gists{/gist_id}","starred_url":"https://api.github.com/users/jsleroy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jsleroy/subscriptions","organizations_url":"https://api.github.com/users/jsleroy/orgs","repos_url":"https://api.github.com/users/jsleroy/repos","events_url":"https://api.github.com/users/jsleroy/events{/privacy}","received_events_url":"https://api.github.com/users/jsleroy/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-07-23T07:41:16Z","updated_at":"2016-07-23T07:41:16Z","closed_at":null,"body":"_From @Yaron10 on March 10, 2016 19:5_\n\nWhen comparing In One-View mode, the current file and the previous file should be compared.\r\nAlso, the current file should always get the top (or left) view.\r\n\r\nNOTE:\r\nThis fix (current at top) does not address \"Compare to last Save\". \r\nI've never used \"Compare to Git\".\r\n***\r\nReplace\r\n```\r\n\tif(!IsWindowVisible(nppData._scintillaMainHandle) || !IsWindowVisible(nppData._scintillaSecondHandle))\r\n\t{\t\r\n\t\tskipAutoReset = true;\r\n\t\tSendMessage(nppData._nppHandle, WM_COMMAND, IDM_VIEW_GOTO_ANOTHER_VIEW, 0);\r\n\t\tskipAutoReset = false;\r\n\t\tpanelsOpened = true;\r\n\t}\r\n```\r\nwith\r\n```\r\n\tif(!IsWindowVisible(nppData._scintillaMainHandle) || !IsWindowVisible(nppData._scintillaSecondHandle))\t// Yaron - One-View mode.\r\n\t{\r\n\t\tskipAutoReset = true;\r\n\r\n\t\t// Yaron - In One-View mode, the current view can be 0 or 1.\r\n\t\t// In Two-Views mode, the top (or left) view is ALWAYS 0, and the bottom view is ALWAYS 1.\r\n\t\tint currentView = SendMessage(nppData._nppHandle, NPPM_GETCURRENTVIEW, 0, 0);\r\n\t\tLRESULT bufferID = SendMessage(nppData._nppHandle, NPPM_GETCURRENTBUFFERID, 0, 0);\r\n\r\n\t\t// Yaron - If the current view is 0, we want the prev file to be moved to the bottom; if the current view is 1, we still need to activate it and make sure it's compared to the current file.\r\n\t\tSendMessage(nppData._nppHandle, WM_COMMAND, IDM_VIEW_TAB_PREV, 0);\r\n\r\n\t\tif(currentView == 1)\r\n\t\t{\r\n\t\t\tbufferID = SendMessage(nppData._nppHandle, NPPM_GETCURRENTBUFFERID, 0, 0);\r\n\t\t\tSendMessage(nppData._nppHandle, WM_COMMAND, IDM_VIEW_TAB_NEXT, 0);\t\t// Yaron - Switch back to current file.\r\n\t\t}\r\n\r\n\t\tSendMessage(nppData._nppHandle, WM_COMMAND, IDM_VIEW_GOTO_ANOTHER_VIEW, 0);\t\t// Yaron - Current file is ALWAYS at top, and prev file is ALWAYS at bottom.\r\n\t\t\r\n\t\tactivateBufferID(bufferID, currentView);\t\t// Yaron - If the current view is 0, activate current file at top; if the current view is 1, activate prev file at bottom (possibly multiple files there).\r\n\r\n\t\tif (currentView == 1)\r\n\t\t\tSendMessage(nppData._nppHandle, WM_COMMAND, IDM_VIEW_SWITCHTO_OTHER_VIEW, 0);       // Yaron - Activate current file at top.\r\n\r\n\t\tskipAutoReset = false;\r\n\t\tpanelsOpened = true;\r\n\t}\r\n```\r\nand add the following function\r\n```\r\nvoid activateBufferID(LRESULT bufferID, int view)\r\n{\r\n\tLRESULT index = SendMessage(nppData._nppHandle, NPPM_GETPOSFROMBUFFERID, bufferID, view);\r\n\tindex = index & 0x3FFFFFFF;\r\n\t\r\n\tSendMessage(nppData._nppHandle, NPPM_ACTIVATEDOC, view, index);\r\n}\r\n```\r\nThank you.\n\n_Copied from original issue: pnedev/compare-plugin#1_"},"comment":{"url":"https://api.github.com/repos/jsleroy/compare-plugin/issues/comments/234705186","html_url":"https://github.com/jsleroy/compare-plugin/issues/22#issuecomment-234705186","issue_url":"https://api.github.com/repos/jsleroy/compare-plugin/issues/22","id":234705186,"user":{"login":"jsleroy","id":88853,"avatar_url":"https://avatars.githubusercontent.com/u/88853?v=3","gravatar_id":"","url":"https://api.github.com/users/jsleroy","html_url":"https://github.com/jsleroy","followers_url":"https://api.github.com/users/jsleroy/followers","following_url":"https://api.github.com/users/jsleroy/following{/other_user}","gists_url":"https://api.github.com/users/jsleroy/gists{/gist_id}","starred_url":"https://api.github.com/users/jsleroy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jsleroy/subscriptions","organizations_url":"https://api.github.com/users/jsleroy/orgs","repos_url":"https://api.github.com/users/jsleroy/repos","events_url":"https://api.github.com/users/jsleroy/events{/privacy}","received_events_url":"https://api.github.com/users/jsleroy/received_events","type":"User","site_admin":false},"created_at":"2016-07-23T07:41:16Z","updated_at":"2016-07-23T07:41:16Z","body":"_From @pnedev on March 13, 2016 0:45_\n\nHi Yaron,\r\n\r\nOne question regarding\r\n\r\n> When comparing In One-View mode, the current file and the previous file should be compared.\r\n\r\nWhy the current file should be compared to the previous and not to the next file? Could you please explain?\r\nI would prefer to compare the current vs. the next file.\r\n\r\nBR,\r\nPavel"}}
{"actor":{"display_login":"jsleroy"}}