{"action":"created","comment":{"url":"https://api.github.com/repos/neovim/neovim/pulls/comments/75871009","id":75871009,"diff_hunk":"@@ -636,6 +634,297 @@ ArrayOf(Integer, 2) buffer_get_mark(Buffer buffer, String name, Error *err)\n   return rv;\n }\n \n+/// Returns mark info at the given position or mark index\n+///\n+/// @param buffer The buffer handle\n+/// @param namespace a identifier returned previously with namespace_create\n+/// @param id [row, col] or mark_id of mark\n+/// @param[out] err Details of an error that may have occurred\n+/// @return [mark_id, row, col]\n+ArrayOf(Object) buffer_mark_index(Buffer buffer, Integer namespace, Object id, Error *err)\n+{\n+  Array rv = ARRAY_DICT_INIT;\n+  ExtendedMark *extmark = extmark_from_id_or_pos(buffer, namespace, id, err);\n+\n+  if (!extmark) {\n+    return rv;\n+  }\n+  ADD(rv, INTEGER_OBJ((Integer)extmark->mark_id));\n+  ADD(rv, INTEGER_OBJ((Integer)extmark->line->lnum));\n+  ADD(rv, INTEGER_OBJ((Integer)extmark->col));\n+  return rv;\n+}\n+\n+/// Returns an ordered list of mark info\n+///\n+/// @param buffer The buffer handle\n+/// @param[out] err Details of an error that may have occurred\n+/// @return [[mark_id, row, col], ...]\n+ArrayOf(Object) buffer_mark_ids(Buffer buffer, Integer namespace, Error *err)\n+{\n+  Array rv = ARRAY_DICT_INIT;\n+  buf_T *buf = find_buffer_by_handle(buffer, err);\n+\n+  if (!buf) {\n+    return rv;\n+  }\n+\n+  ExtmarkArray *all_extmarks = extmark_ids(buf, (uint64_t)namespace);\n+  ExtendedMark *extmark = NULL;\n+  Array mark = ARRAY_DICT_INIT;\n+  for (size_t i = 0; i < kv_size(*all_extmarks); i++) {\n+    mark.size = 0;\n+    mark.capacity = 0;\n+    mark.items = 0;\n+    extmark = kv_A(*all_extmarks, i);\n+    ADD(mark, INTEGER_OBJ((Integer)extmark->mark_id));\n+    ADD(mark, INTEGER_OBJ(extmark->line->lnum));\n+    ADD(mark, INTEGER_OBJ(extmark->col));\n+    ADD(rv, ARRAY_OBJ(mark));\n+  }\n+  return rv;\n+}\n+\n+/// Returns mark info of the mark following the given index\n+/// If there are no following marks returns [-1, -1, -1]\n+///\n+/// @param buffer The buffer handle\n+/// @param namespace a identifier returned previously with namespace_create\n+/// @param id The mark's id\n+/// @param[out] err Details of an error that may have occurred\n+/// @return [id, row, col]\n+ArrayOf(Integer, 3) buffer_mark_next(Buffer buffer, Integer namespace, Object id, Error *err)\n+{\n+  Array rv = ARRAY_DICT_INIT;\n+  buf_T *buf = find_buffer_by_handle(buffer, err);\n+\n+  ExtendedMark *extmark = extmark_from_id_or_pos(buffer, namespace, id, err);\n+  if (!extmark) {\n+    return rv;\n+  }\n+\n+  bool match = 0;\n+  ExtendedMark *next = extmark_next(buf, (uint64_t)namespace, extmark->line->lnum, extmark->col, match);\n+  if (!next) {\n+    ADD(rv, INTEGER_OBJ(-1));\n+    ADD(rv, INTEGER_OBJ(-1));\n+    ADD(rv, INTEGER_OBJ(-1));\n+  } else {\n+    ADD(rv, INTEGER_OBJ((Integer)next->mark_id));\n+    ADD(rv, INTEGER_OBJ(next->line->lnum));\n+    ADD(rv, INTEGER_OBJ(next->col));\n+  }\n+  return rv;\n+}\n+\n+/// Returns mark info inbetween and including the bounds\n+/// If there are no following marks returns [-1, -1, -1] // TODO\n+/// To search untill the end of the buffer do an upper bound of -1 //TODO\n+///\n+/// @param buffer The buffer handle\n+/// @param namespace a identifier returned previously with namespace_create\n+/// @param lower [row, col] or mark_id of lower bound\n+/// @param uower [row, col] or mark_id of upper bound\n+/// @param[out] err Details of an error that may have occurred\n+/// @return [[mark_id, row, col], ...]\n+ArrayOf(Object) buffer_mark_nextrange(Buffer buffer, Integer namespace, Object lower, Object upper, Error *err)\n+{\n+  Array rv = ARRAY_DICT_INIT;\n+  buf_T *buf = find_buffer_by_handle(buffer, err);\n+\n+  ExtendedMark *l_extmark = extmark_from_id_or_pos(buffer, namespace, lower, err);\n+  ExtendedMark *u_extmark = extmark_from_id_or_pos(buffer, namespace, upper, err);\n+  if(!l_extmark || !u_extmark) {\n+    return rv;\n+  }\n+  ExtmarkArray *extmarks_in_range = extmark_nextrange(buf, (uint64_t)namespace,\n+                                           l_extmark->line->lnum, l_extmark->col,\n+                                           u_extmark->line->lnum, u_extmark->col);\n+\n+  if (!extmarks_in_range) {\n+    ADD(rv, INTEGER_OBJ(-9));\n+    return rv;\n+  }\n+\n+  Array mark = ARRAY_DICT_INIT;\n+  ExtendedMark *extmark;\n+  for (size_t i = 0; i < kv_size(*extmarks_in_range); i++) {\n+    mark.size = 0;\n+    mark.capacity = 0;\n+    mark.items = 0;\n+    extmark = kv_A(*extmarks_in_range, i);\n+    ADD(mark, INTEGER_OBJ( (Integer)extmark->mark_id) );\n+    ADD(mark, INTEGER_OBJ(extmark->line->lnum));\n+    ADD(mark, INTEGER_OBJ(extmark->col));\n+    ADD(rv, ARRAY_OBJ(mark));\n+  }\n+  return rv;\n+}\n+\n+/// Setup a new namepsace for holding you marks\n+///\n+/// @param namespace String name for the namespace\n+/// @param[out] err Details of an error that may have occurred\n+/// @return integer id to be used with future mark_ calls, or 0 if name exists\n+Integer buffer_mark_ns_init(String namespace, Error *err)\n+{\n+  uint64_t ns_id = extmark_ns_create(namespace.data);\n+  if (!ns_id) {\n+    api_set_error(err, Validation, _(\"Namespace already exists\"));\n+    return 0;\n+  }\n+  return ns_id;\n+}\n+\n+/// Returns a list of mark namespaces in nvim\n+///\n+/// @param[out] err Details of an error that may have occurred\n+/// @return [[string name, int id], ...]\n+ArrayOf(Object) buffer_mark_ns_ids(Error *err)\n+{\n+  Array rv = ARRAY_DICT_INIT;\n+  Array ns_array = ARRAY_DICT_INIT;\n+\n+  /* TODO can delete? */\n+  if (!NAMESPACES) {\n+    return rv;\n+  }\n+\n+  cstr_t key;\n+  uint64_t value;\n+  map_foreach(NAMESPACES, key, value, {\n+    ns_array.size = 0;\n+    ns_array.capacity = 0;\n+    ns_array.items = 0;\n+    ADD(ns_array, STRING_OBJ(cstr_to_string(key)));\n+    ADD(ns_array, INTEGER_OBJ(value));\n+    ADD(rv, ARRAY_OBJ(ns_array));\n+  });\n+  return rv;\n+}\n+\n+\n+/// Returns mark info of the mark preceding the given index\n+/// If there are no previous marks returns [-1, -1, -1] // TODO","path":"src/nvim/api/buffer.c","position":198,"original_position":198,"commit_id":"e372b69d4c8e95e111e6194b6c157ea7c1b66cb1","original_commit_id":"e372b69d4c8e95e111e6194b6c157ea7c1b66cb1","user":{"login":"timeyyy","id":6135075,"avatar_url":"https://avatars.githubusercontent.com/u/6135075?v=3","gravatar_id":"","url":"https://api.github.com/users/timeyyy","html_url":"https://github.com/timeyyy","followers_url":"https://api.github.com/users/timeyyy/followers","following_url":"https://api.github.com/users/timeyyy/following{/other_user}","gists_url":"https://api.github.com/users/timeyyy/gists{/gist_id}","starred_url":"https://api.github.com/users/timeyyy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timeyyy/subscriptions","organizations_url":"https://api.github.com/users/timeyyy/orgs","repos_url":"https://api.github.com/users/timeyyy/repos","events_url":"https://api.github.com/users/timeyyy/events{/privacy}","received_events_url":"https://api.github.com/users/timeyyy/received_events","type":"User","site_admin":false},"body":"What use case would this have? its saves a little bit of scripting? Could we defer this if a good use case presents itself?\r\nThe call signature is already getting quite unwieldy\r\n`mark_range(0, 1, [1, 0] , [2,0])`, it's one more flag we have to put on.","created_at":"2016-08-23T13:59:18Z","updated_at":"2016-08-23T13:59:18Z","html_url":"https://github.com/neovim/neovim/pull/5031#discussion_r75871009","pull_request_url":"https://api.github.com/repos/neovim/neovim/pulls/5031","_links":{"self":{"href":"https://api.github.com/repos/neovim/neovim/pulls/comments/75871009"},"html":{"href":"https://github.com/neovim/neovim/pull/5031#discussion_r75871009"},"pull_request":{"href":"https://api.github.com/repos/neovim/neovim/pulls/5031"}}},"pull_request":{"url":"https://api.github.com/repos/neovim/neovim/pulls/5031","id":76885836,"html_url":"https://github.com/neovim/neovim/pull/5031","diff_url":"https://github.com/neovim/neovim/pull/5031.diff","patch_url":"https://github.com/neovim/neovim/pull/5031.patch","issue_url":"https://api.github.com/repos/neovim/neovim/issues/5031","number":5031,"state":"open","locked":false,"title":"[WIP] Extended Marks","user":{"login":"timeyyy","id":6135075,"avatar_url":"https://avatars.githubusercontent.com/u/6135075?v=3","gravatar_id":"","url":"https://api.github.com/users/timeyyy","html_url":"https://github.com/timeyyy","followers_url":"https://api.github.com/users/timeyyy/followers","following_url":"https://api.github.com/users/timeyyy/following{/other_user}","gists_url":"https://api.github.com/users/timeyyy/gists{/gist_id}","starred_url":"https://api.github.com/users/timeyyy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timeyyy/subscriptions","organizations_url":"https://api.github.com/users/timeyyy/orgs","repos_url":"https://api.github.com/users/timeyyy/repos","events_url":"https://api.github.com/users/timeyyy/events{/privacy}","received_events_url":"https://api.github.com/users/timeyyy/received_events","type":"User","site_admin":false},"body":"These are marks designed for developers who want to build plugins or embed neovim.\r\n\r\nissue #4816 ","created_at":"2016-07-10T22:48:07Z","updated_at":"2016-08-23T13:59:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9fb53e43610570ca8040580e3c2861d0c03eae80","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/neovim/neovim/pulls/5031/commits","review_comments_url":"https://api.github.com/repos/neovim/neovim/pulls/5031/comments","review_comment_url":"https://api.github.com/repos/neovim/neovim/pulls/comments{/number}","comments_url":"https://api.github.com/repos/neovim/neovim/issues/5031/comments","statuses_url":"https://api.github.com/repos/neovim/neovim/statuses/e372b69d4c8e95e111e6194b6c157ea7c1b66cb1","head":{"label":"timeyyy:extended_marks","ref":"extended_marks","sha":"e372b69d4c8e95e111e6194b6c157ea7c1b66cb1","user":{"login":"timeyyy","id":6135075,"avatar_url":"https://avatars.githubusercontent.com/u/6135075?v=3","gravatar_id":"","url":"https://api.github.com/users/timeyyy","html_url":"https://github.com/timeyyy","followers_url":"https://api.github.com/users/timeyyy/followers","following_url":"https://api.github.com/users/timeyyy/following{/other_user}","gists_url":"https://api.github.com/users/timeyyy/gists{/gist_id}","starred_url":"https://api.github.com/users/timeyyy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timeyyy/subscriptions","organizations_url":"https://api.github.com/users/timeyyy/orgs","repos_url":"https://api.github.com/users/timeyyy/repos","events_url":"https://api.github.com/users/timeyyy/events{/privacy}","received_events_url":"https://api.github.com/users/timeyyy/received_events","type":"User","site_admin":false},"repo":{"id":62509010,"name":"neovim","full_name":"timeyyy/neovim","owner":{"login":"timeyyy","id":6135075,"avatar_url":"https://avatars.githubusercontent.com/u/6135075?v=3","gravatar_id":"","url":"https://api.github.com/users/timeyyy","html_url":"https://github.com/timeyyy","followers_url":"https://api.github.com/users/timeyyy/followers","following_url":"https://api.github.com/users/timeyyy/following{/other_user}","gists_url":"https://api.github.com/users/timeyyy/gists{/gist_id}","starred_url":"https://api.github.com/users/timeyyy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timeyyy/subscriptions","organizations_url":"https://api.github.com/users/timeyyy/orgs","repos_url":"https://api.github.com/users/timeyyy/repos","events_url":"https://api.github.com/users/timeyyy/events{/privacy}","received_events_url":"https://api.github.com/users/timeyyy/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/timeyyy/neovim","description":"Vim-fork focused on extensibility and agility.","fork":true,"url":"https://api.github.com/repos/timeyyy/neovim","forks_url":"https://api.github.com/repos/timeyyy/neovim/forks","keys_url":"https://api.github.com/repos/timeyyy/neovim/keys{/key_id}","collaborators_url":"https://api.github.com/repos/timeyyy/neovim/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/timeyyy/neovim/teams","hooks_url":"https://api.github.com/repos/timeyyy/neovim/hooks","issue_events_url":"https://api.github.com/repos/timeyyy/neovim/issues/events{/number}","events_url":"https://api.github.com/repos/timeyyy/neovim/events","assignees_url":"https://api.github.com/repos/timeyyy/neovim/assignees{/user}","branches_url":"https://api.github.com/repos/timeyyy/neovim/branches{/branch}","tags_url":"https://api.github.com/repos/timeyyy/neovim/tags","blobs_url":"https://api.github.com/repos/timeyyy/neovim/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/timeyyy/neovim/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/timeyyy/neovim/git/refs{/sha}","trees_url":"https://api.github.com/repos/timeyyy/neovim/git/trees{/sha}","statuses_url":"https://api.github.com/repos/timeyyy/neovim/statuses/{sha}","languages_url":"https://api.github.com/repos/timeyyy/neovim/languages","stargazers_url":"https://api.github.com/repos/timeyyy/neovim/stargazers","contributors_url":"https://api.github.com/repos/timeyyy/neovim/contributors","subscribers_url":"https://api.github.com/repos/timeyyy/neovim/subscribers","subscription_url":"https://api.github.com/repos/timeyyy/neovim/subscription","commits_url":"https://api.github.com/repos/timeyyy/neovim/commits{/sha}","git_commits_url":"https://api.github.com/repos/timeyyy/neovim/git/commits{/sha}","comments_url":"https://api.github.com/repos/timeyyy/neovim/comments{/number}","issue_comment_url":"https://api.github.com/repos/timeyyy/neovim/issues/comments{/number}","contents_url":"https://api.github.com/repos/timeyyy/neovim/contents/{+path}","compare_url":"https://api.github.com/repos/timeyyy/neovim/compare/{base}...{head}","merges_url":"https://api.github.com/repos/timeyyy/neovim/merges","archive_url":"https://api.github.com/repos/timeyyy/neovim/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/timeyyy/neovim/downloads","issues_url":"https://api.github.com/repos/timeyyy/neovim/issues{/number}","pulls_url":"https://api.github.com/repos/timeyyy/neovim/pulls{/number}","milestones_url":"https://api.github.com/repos/timeyyy/neovim/milestones{/number}","notifications_url":"https://api.github.com/repos/timeyyy/neovim/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/timeyyy/neovim/labels{/name}","releases_url":"https://api.github.com/repos/timeyyy/neovim/releases{/id}","deployments_url":"https://api.github.com/repos/timeyyy/neovim/deployments","created_at":"2016-07-03T18:08:23Z","updated_at":"2016-07-03T18:08:30Z","pushed_at":"2016-08-23T00:01:03Z","git_url":"git://github.com/timeyyy/neovim.git","ssh_url":"git@github.com:timeyyy/neovim.git","clone_url":"https://github.com/timeyyy/neovim.git","svn_url":"https://github.com/timeyyy/neovim","homepage":"https://salt.bountysource.com/teams/neovim","size":40827,"stargazers_count":0,"watchers_count":0,"language":"VimL","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"neovim:master","ref":"master","sha":"ae6db26b0956f4a30185cfe0294143e73a37052e","user":{"login":"neovim","id":6471485,"avatar_url":"https://avatars.githubusercontent.com/u/6471485?v=3","gravatar_id":"","url":"https://api.github.com/users/neovim","html_url":"https://github.com/neovim","followers_url":"https://api.github.com/users/neovim/followers","following_url":"https://api.github.com/users/neovim/following{/other_user}","gists_url":"https://api.github.com/users/neovim/gists{/gist_id}","starred_url":"https://api.github.com/users/neovim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neovim/subscriptions","organizations_url":"https://api.github.com/users/neovim/orgs","repos_url":"https://api.github.com/users/neovim/repos","events_url":"https://api.github.com/users/neovim/events{/privacy}","received_events_url":"https://api.github.com/users/neovim/received_events","type":"Organization","site_admin":false},"repo":{"id":16408992,"name":"neovim","full_name":"neovim/neovim","owner":{"login":"neovim","id":6471485,"avatar_url":"https://avatars.githubusercontent.com/u/6471485?v=3","gravatar_id":"","url":"https://api.github.com/users/neovim","html_url":"https://github.com/neovim","followers_url":"https://api.github.com/users/neovim/followers","following_url":"https://api.github.com/users/neovim/following{/other_user}","gists_url":"https://api.github.com/users/neovim/gists{/gist_id}","starred_url":"https://api.github.com/users/neovim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neovim/subscriptions","organizations_url":"https://api.github.com/users/neovim/orgs","repos_url":"https://api.github.com/users/neovim/repos","events_url":"https://api.github.com/users/neovim/events{/privacy}","received_events_url":"https://api.github.com/users/neovim/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/neovim/neovim","description":"Vim-fork focused on extensibility and agility.","fork":false,"url":"https://api.github.com/repos/neovim/neovim","forks_url":"https://api.github.com/repos/neovim/neovim/forks","keys_url":"https://api.github.com/repos/neovim/neovim/keys{/key_id}","collaborators_url":"https://api.github.com/repos/neovim/neovim/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/neovim/neovim/teams","hooks_url":"https://api.github.com/repos/neovim/neovim/hooks","issue_events_url":"https://api.github.com/repos/neovim/neovim/issues/events{/number}","events_url":"https://api.github.com/repos/neovim/neovim/events","assignees_url":"https://api.github.com/repos/neovim/neovim/assignees{/user}","branches_url":"https://api.github.com/repos/neovim/neovim/branches{/branch}","tags_url":"https://api.github.com/repos/neovim/neovim/tags","blobs_url":"https://api.github.com/repos/neovim/neovim/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/neovim/neovim/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/neovim/neovim/git/refs{/sha}","trees_url":"https://api.github.com/repos/neovim/neovim/git/trees{/sha}","statuses_url":"https://api.github.com/repos/neovim/neovim/statuses/{sha}","languages_url":"https://api.github.com/repos/neovim/neovim/languages","stargazers_url":"https://api.github.com/repos/neovim/neovim/stargazers","contributors_url":"https://api.github.com/repos/neovim/neovim/contributors","subscribers_url":"https://api.github.com/repos/neovim/neovim/subscribers","subscription_url":"https://api.github.com/repos/neovim/neovim/subscription","commits_url":"https://api.github.com/repos/neovim/neovim/commits{/sha}","git_commits_url":"https://api.github.com/repos/neovim/neovim/git/commits{/sha}","comments_url":"https://api.github.com/repos/neovim/neovim/comments{/number}","issue_comment_url":"https://api.github.com/repos/neovim/neovim/issues/comments{/number}","contents_url":"https://api.github.com/repos/neovim/neovim/contents/{+path}","compare_url":"https://api.github.com/repos/neovim/neovim/compare/{base}...{head}","merges_url":"https://api.github.com/repos/neovim/neovim/merges","archive_url":"https://api.github.com/repos/neovim/neovim/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/neovim/neovim/downloads","issues_url":"https://api.github.com/repos/neovim/neovim/issues{/number}","pulls_url":"https://api.github.com/repos/neovim/neovim/pulls{/number}","milestones_url":"https://api.github.com/repos/neovim/neovim/milestones{/number}","notifications_url":"https://api.github.com/repos/neovim/neovim/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/neovim/neovim/labels{/name}","releases_url":"https://api.github.com/repos/neovim/neovim/releases{/id}","deployments_url":"https://api.github.com/repos/neovim/neovim/deployments","created_at":"2014-01-31T13:39:22Z","updated_at":"2016-08-23T13:49:16Z","pushed_at":"2016-08-23T07:51:53Z","git_url":"git://github.com/neovim/neovim.git","ssh_url":"git@github.com:neovim/neovim.git","clone_url":"https://github.com/neovim/neovim.git","svn_url":"https://github.com/neovim/neovim","homepage":"https://salt.bountysource.com/teams/neovim","size":69588,"stargazers_count":19692,"watchers_count":19692,"language":"VimL","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1394,"mirror_url":null,"open_issues_count":748,"forks":1394,"open_issues":748,"watchers":19692,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/neovim/neovim/pulls/5031"},"html":{"href":"https://github.com/neovim/neovim/pull/5031"},"issue":{"href":"https://api.github.com/repos/neovim/neovim/issues/5031"},"comments":{"href":"https://api.github.com/repos/neovim/neovim/issues/5031/comments"},"review_comments":{"href":"https://api.github.com/repos/neovim/neovim/pulls/5031/comments"},"review_comment":{"href":"https://api.github.com/repos/neovim/neovim/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/neovim/neovim/pulls/5031/commits"},"statuses":{"href":"https://api.github.com/repos/neovim/neovim/statuses/e372b69d4c8e95e111e6194b6c157ea7c1b66cb1"}}}}
{"actor":{"display_login":"timeyyy"}}