Skip to content

Commit

Permalink
Fix more bugs in the Object Browser
Browse files Browse the repository at this point in the history
  • Loading branch information
jalvesaq committed Feb 8, 2024
1 parent a556087 commit 98937ae
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 15 deletions.
6 changes: 3 additions & 3 deletions R/nvimcom/src/apps/data_structures.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
static ListStatus *listTree = NULL; // Root node of the list status tree
ListStatus *search(const char *s) {
ListStatus *node = listTree;

ListStatus *search(ListStatus *root, const char *s) {
ListStatus *node = root;
int cmp = strcmp(node->key, s);
while (node && cmp != 0) {
if (cmp > 0)
Expand Down
3 changes: 2 additions & 1 deletion R/nvimcom/src/apps/data_structures.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ typedef struct liststatus_ {
struct liststatus_ *left; // Left node
struct liststatus_ *right; // Right node
} ListStatus;
ListStatus *search(const char *s);

ListStatus *new_ListStatus(const char *s, int stt);
ListStatus *insert(ListStatus *root, const char *s, int stt);
ListStatus *search(ListStatus *root, const char *s);

// Structure for package data
typedef struct pkg_data_ {
Expand Down
16 changes: 6 additions & 10 deletions R/nvimcom/src/apps/nvimrserver.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ LibPath *libpaths; // Pointer to first library path

InstLibs *instlibs; // Pointer to first installed library

static ListStatus *listTree = NULL; // Root node of the list status tree
static ListStatus *listTree; // Root node of the list status tree

PkgData *pkgList; // Pointer to first package data
static int nLibObjs; // Number of library objects
Expand Down Expand Up @@ -1529,14 +1529,10 @@ void update_pkg_list(char *libnms) {
* @return
*/
int get_list_status(const char *s, int stt) {
if (listTree) {
ListStatus *p = search(s);
if (p)
return p->status;
insert(listTree, s, stt);
return stt;
}
listTree = new_ListStatus(s, stt);
ListStatus *p = search(listTree, s);
if (p)
return p->status;
insert(listTree, s, stt);
return stt;
}

Expand All @@ -1547,7 +1543,7 @@ int get_list_status(const char *s, int stt) {
* @param s:
*/
void toggle_list_status(const char *s) {
ListStatus *p = search(s);
ListStatus *p = search(listTree, s);
if (p)
p->status = !p->status;
}
Expand Down
2 changes: 1 addition & 1 deletion lua/r/browser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ M.on_double_click = function()
require("r.send").cmd("str(" .. key .. ")")
end
else
if curline:find("(#.* ") then
if curline:find("%(#.* ") then
key = key:gsub("`", "")
require("r.doc").ask_R_doc(key, M.get_pkg_name(), false)
else
Expand Down
1 change: 1 addition & 0 deletions lua/r/nrs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ local StartNServer = function()
on_exit = require("r.job").on_exit,
env = nrs_env,
}
-- require("r.job").start("Server", { "valgrind", "--log-file=/tmp/rnvimserver_valgrind_log", nrs_path }, nrs_opts)
require("r.job").start("Server", { nrs_path }, nrs_opts)
vim.g.R_Nvim_status = 2

Expand Down

0 comments on commit 98937ae

Please sign in to comment.