Discussion:
Amusing Nedit problem ...
Greg Edwards
2009-10-23 06:26:40 UTC
Permalink
With the advent of tabbed web browsers, some of which have a "+" button on
the far right of the tab area to create a new tab (certainly my Safari 4
anyway), I now find myself hitting the Nedit "x" button to open a new tab,
but of course closing the current Nedit tab instead, quite the opposite of
what I wanted.
How much chance would there be to make the "x" act as a "+", and put an "x"
on the Motif tabs ? (I know the answer to part B sadly - a Motif tab is just
some sort of XmLabel subclass with a tabby shape, no chance of "x" there).
--
Greg Edwards
mob 0400 102 774
--
NEdit Discuss mailing list - Discuss-***@public.gmane.org
http://www.nedit.org/mailman/listinfo/discuss
Bert Wesarg
2009-10-25 14:24:19 UTC
Permalink
Post by Greg Edwards
With the advent of tabbed web browsers, some of which have a "+" button on
the far right of the tab area to create a new tab (certainly my Safari 4
anyway), I now find myself hitting the Nedit "x" button to open a new tab,
but of course closing the current Nedit tab instead, quite the opposite of
what I wanted.
How much chance would there be to make the "x" act as a "+", and put an "x"
on the Motif tabs ? (I know the answer to part B sadly - a Motif tab is just
some sort of XmLabel subclass with a tabby shape, no chance of "x" there).
I personally like the 'floating' "+" from firefox 3.5 more, that is, a 'tab'
right of all other tabs, and if you click it, you get a new Untitled, and only
one close button, like it is today in NEdit. Here is a rough patch that
implements this.

BTW, you can put any widget inside the tabs, NEdit puts a BubbleButton in to
get a tooltip.

Regards,
Bert

---
Microline/XmL/Folder.c | 2 +-
source/window.c | 56 ++++++++++++++++++++++++++++++++++++------------
2 files changed, 43 insertions(+), 15 deletions(-)

diff --git a/Microline/XmL/Folder.c b/Microline/XmL/Folder.c
index 270cf96..2610199 100644
--- a/Microline/XmL/Folder.c
+++ b/Microline/XmL/Folder.c
@@ -1658,7 +1658,7 @@ ConstraintInitialize(Widget req,
/* add child to tabs list */
if (f->folder.tabAllocCount < f->folder.tabCount + 1)
{
- f->folder.tabAllocCount *= 2;
+ f->folder.tabAllocCount += 32;
f->folder.tabs = (Widget *)realloc((char *)f->folder.tabs,
sizeof(Widget) * f->folder.tabAllocCount);
}
diff --git a/source/window.c b/source/window.c
index 89473a8..995eea2 100644
--- a/source/window.c
+++ b/source/window.c
@@ -152,7 +152,7 @@ static Pixmap createBitmapWithDepth(Widget w, char *data, unsigned int width,
unsigned int height);
static WindowInfo *getNextTabWindow(WindowInfo *window, int direction,
int crossWin, int wrap);
-static Widget addTab(Widget folder, const char *string);
+static Widget addTab(Widget folder, const char *string, int isNewTabTab);
static int compareWindowNames(const void *windowA, const void *windowB);
static int getTabPosition(Widget tab);
static Widget manageToolBars(Widget toolBarsForm);
@@ -614,7 +614,8 @@ WindowInfo *CreateWindow(const char *name, char *geometry, int iconic)
XtAddCallback(window->tabBar, XmNactivateCallback,
raiseTabCB, NULL);

- window->tab = addTab(window->tabBar, name);
+ addTab(window->tabBar, " + ", True);
+ window->tab = addTab(window->tabBar, name, False);

/* A form to hold the stats line text and line/col widgets */
window->statsLineForm = XtVaCreateWidget("statsLineForm",
@@ -821,19 +822,23 @@ static void tabClickEH(Widget w, XtPointer clientData, XEvent *event)
/*
** add a tab to the tab bar for the new document.
*/
-static Widget addTab(Widget folder, const char *string)
+static Widget addTab(Widget folder, const char *string, int isNewTabTab)
{
Widget tooltipLabel, tab;
- XmString s1;
+ XmString s1, s2;

s1 = XmStringCreateSimple((char *)string);
+ if (isNewTabTab)
+ s2 = XmStringCreateSimple("New Document");
+ else
+ s2 = s1;
tab = XtVaCreateManagedWidget("tab",
xrwsBubbleButtonWidgetClass, folder,
/* XmNmarginWidth, <***@nedit.c>, */
/* XmNmarginHeight, <***@nedit.c>, */
/* XmNalignment, <***@nedit.c>, */
XmNlabelString, s1,
- XltNbubbleString, s1,
+ XltNbubbleString, s2,
XltNshowBubble, GetPrefToolTips(),
XltNautoParkBubble, True,
XltNslidingBubble, False,
@@ -841,6 +846,8 @@ static Widget addTab(Widget folder, const char *string)
/* XltNbubbleDuration, 8000,*/
NULL);
XmStringFree(s1);
+ if (isNewTabTab)
+ XmStringFree(s2);

/* there's things to do as user click on the tab */
XtAddEventHandler(tab, ButtonPressMask, False,
@@ -864,6 +871,17 @@ static Widget addTab(Widget folder, const char *string)
AddTabContextMenuAction(tab);
#endif /* LESSTIF_VERSION */

+ if (!isNewTabTab) {
+ WidgetList tabList;
+ int tabCount;
+ Widget t;
+ XtVaGetValues(folder, XmNtabWidgetList, &tabList,
+ XmNtabCount, &tabCount, NULL);
+ t = tabList[tabCount - 1];
+ tabList[tabCount - 1] = tabList[tabCount - 2];
+ tabList[tabCount - 2] = t;
+ }
+
return tab;
}

@@ -915,7 +933,7 @@ void SortTabBar(WindowInfo *window)
XtVaGetValues(window->tabBar, XmNtabWidgetList, &tabList,
XmNtabCount, &tabCount, NULL);

- for (i=0, j=0; i<tabCount && j<nDoc; i++) {
+ for (i=0, j=0; i<(tabCount-1) && j<nDoc; i++) {
if (tabList[i]->core.being_destroyed)
continue;

@@ -2500,7 +2518,7 @@ static void saveYourselfCB(Widget w, Widget appShell, XtPointer callData)
XtVaGetValues(topWin->tabBar, XmNtabWidgetList, &tabs,
XmNtabCount, &tabCount, NULL);

- for (i=0; i< tabCount; i++) {
+ for (i=0; i< (tabCount-1); i++) {
win = TabToWindow(tabs[i]);
if (win->filenameSet) {
/* add filename */
@@ -3441,7 +3459,7 @@ WindowInfo* CreateDocument(WindowInfo* shellWindow, const char* name)
/* Set the requested hardware tab distance and useTabs in the text buffer */
BufSetTabDistance(window->buffer, GetPrefTabDist(PLAIN_LANGUAGE_MODE));
window->buffer->useTabs = GetPrefInsertTabs();
- window->tab = addTab(window->tabBar, name);
+ window->tab = addTab(window->tabBar, name, False);

/* add the window to the global window list, update the Windows menus */
InvalidateWindowMenus();
@@ -3514,7 +3532,7 @@ static WindowInfo *getNextTabWindow(WindowInfo *window, int direction,
XtVaGetValues(win->tabBar, XmNtabWidgetList, &tabList,
XmNtabCount, &tabCount, NULL);

- for (i=0; i< tabCount; i++) {
+ for (i=0; i< (tabCount-1); i++) {
tabs[tabTotalCount++] = tabList[i];
}
}
@@ -3524,7 +3542,7 @@ static WindowInfo *getNextTabWindow(WindowInfo *window, int direction,
XtVaGetValues(window->tabBar, XmNtabWidgetList, &tabList,
XmNtabCount, &tabCount, NULL);

- for (i=0; i< tabCount; i++) {
+ for (i=0; i< (tabCount-1); i++) {
if (TabToWindow(tabList[i])) /* make sure tab is valid */
tabs[tabTotalCount++] = tabList[i];
}
@@ -3572,7 +3590,7 @@ static int getTabPosition(Widget tab)
XtVaGetValues(tabBar, XmNtabWidgetList, &tabList,
XmNtabCount, &tabCount, NULL);

- for (i=0; i< tabCount; i++) {
+ for (i=0; i< (tabCount-1); i++) {
if (tab == tabList[i])
return i;
}
@@ -4690,10 +4708,20 @@ static void raiseTabCB(Widget w, XtPointer clientData, XtPointer callData)
XmLFolderCallbackStruct *cbs = (XmLFolderCallbackStruct *)callData;
WidgetList tabList;
Widget tab;
+ int tabCount;

- XtVaGetValues(w, XmNtabWidgetList, &tabList, NULL);
- tab = tabList[cbs->pos];
- RaiseDocument(TabToWindow(tab));
+ XtVaGetValues(w, XmNtabWidgetList, &tabList, XmNtabCount, &tabCount, NULL);
+ if (cbs->pos < (tabCount-1)) {
+ tab = tabList[cbs->pos];
+ RaiseDocument(TabToWindow(tab));
+ } else {
+ WindowInfo *window = lastFocusDocument;
+ if (!window)
+ window = TabToWindow(tabList[cbs->pos - 2]);
+ EditNewFile(window, NULL, False, NULL, window->path, False);
+ CheckCloseDim();
+ cbs->allowActivate = 0;
+ }
}

static Widget containingPane(Widget w)
--
tg: (58cda00..) bw/newTabTab (depends on: master)
--
NEdit Discuss mailing list - Discuss-***@public.gmane.org
http://www.nedit.org/mailman/listinfo/discuss
TK Soh
2009-10-26 00:25:16 UTC
Permalink
OT: where do you host your nedit repo? I'm trying to refresh my local
clone. Thanks.

TK
Post by Bert Wesarg
Post by Greg Edwards
With the advent of tabbed web browsers, some of which have a "+" button on
the far right of the tab area to create a new tab (certainly my Safari 4
anyway), I now find myself hitting the Nedit "x" button to open a new tab,
but of course closing the current Nedit tab instead, quite the opposite of
what I wanted.
How much chance would there be to make the "x" act as a "+", and put an "x"
on the Motif tabs ? (I know the answer to part B sadly - a Motif tab is just
some sort of XmLabel subclass with a tabby shape, no chance of "x" there).
I personally like the 'floating' "+" from firefox 3.5 more, that is, a 'tab'
right of all other tabs, and if you click it, you get a new Untitled, and only
one close button, like it is today in NEdit. Here is a rough patch that
implements this.
BTW, you can put any widget inside the tabs, NEdit puts a BubbleButton in to
get a tooltip.
Regards,
Bert
---
 Microline/XmL/Folder.c |    2 +-
 source/window.c        |   56 ++++++++++++++++++++++++++++++++++++------------
 2 files changed, 43 insertions(+), 15 deletions(-)
diff --git a/Microline/XmL/Folder.c b/Microline/XmL/Folder.c
index 270cf96..2610199 100644
--- a/Microline/XmL/Folder.c
+++ b/Microline/XmL/Folder.c
@@ -1658,7 +1658,7 @@ ConstraintInitialize(Widget req,
      /* add child to tabs list */
      if (f->folder.tabAllocCount < f->folder.tabCount + 1)
       {
-         f->folder.tabAllocCount *= 2;
+         f->folder.tabAllocCount += 32;
         f->folder.tabs = (Widget *)realloc((char *)f->folder.tabs,
                                            sizeof(Widget) * f->folder.tabAllocCount);
       }
diff --git a/source/window.c b/source/window.c
index 89473a8..995eea2 100644
--- a/source/window.c
+++ b/source/window.c
@@ -152,7 +152,7 @@ static Pixmap createBitmapWithDepth(Widget w, char *data, unsigned int width,
       unsigned int height);
 static WindowInfo *getNextTabWindow(WindowInfo *window, int direction,
        int crossWin, int wrap);
-static Widget addTab(Widget folder, const char *string);
+static Widget addTab(Widget folder, const char *string, int isNewTabTab);
 static int compareWindowNames(const void *windowA, const void *windowB);
 static int getTabPosition(Widget tab);
 static Widget manageToolBars(Widget toolBarsForm);
@@ -614,7 +614,8 @@ WindowInfo *CreateWindow(const char *name, char *geometry, int iconic)
    XtAddCallback(window->tabBar, XmNactivateCallback,
           raiseTabCB, NULL);
-    window->tab = addTab(window->tabBar, name);
+    addTab(window->tabBar, " + ", True);
+    window->tab = addTab(window->tabBar, name, False);
    /* A form to hold the stats line text and line/col widgets */
    window->statsLineForm = XtVaCreateWidget("statsLineForm",
@@ -821,19 +822,23 @@ static void tabClickEH(Widget w, XtPointer clientData, XEvent *event)
 /*
 ** add a tab to the tab bar for the new document.
 */
-static Widget addTab(Widget folder, const char *string)
+static Widget addTab(Widget folder, const char *string, int isNewTabTab)
 {
    Widget tooltipLabel, tab;
-    XmString s1;
+    XmString s1, s2;
    s1 = XmStringCreateSimple((char *)string);
+    if (isNewTabTab)
+        s2 = XmStringCreateSimple("New Document");
+    else
+        s2 = s1;
    tab = XtVaCreateManagedWidget("tab",
           xrwsBubbleButtonWidgetClass, folder,
           XmNlabelString, s1,
-           XltNbubbleString, s1,
+           XltNbubbleString, s2,
           XltNshowBubble, GetPrefToolTips(),
           XltNautoParkBubble, True,
           XltNslidingBubble, False,
@@ -841,6 +846,8 @@ static Widget addTab(Widget folder, const char *string)
           /* XltNbubbleDuration, 8000,*/
           NULL);
    XmStringFree(s1);
+    if (isNewTabTab)
+        XmStringFree(s2);
    /* there's things to do as user click on the tab */
    XtAddEventHandler(tab, ButtonPressMask, False,
@@ -864,6 +871,17 @@ static Widget addTab(Widget folder, const char *string)
    AddTabContextMenuAction(tab);
 #endif /* LESSTIF_VERSION */
+    if (!isNewTabTab) {
+        WidgetList tabList;
+        int tabCount;
+        Widget t;
+        XtVaGetValues(folder, XmNtabWidgetList, &tabList,
+                      XmNtabCount, &tabCount, NULL);
+        t = tabList[tabCount - 1];
+        tabList[tabCount - 1] = tabList[tabCount - 2];
+        tabList[tabCount - 2] = t;
+    }
+
    return tab;
 }
@@ -915,7 +933,7 @@ void SortTabBar(WindowInfo *window)
    XtVaGetValues(window->tabBar, XmNtabWidgetList, &tabList,
                  XmNtabCount, &tabCount, NULL);
-    for (i=0, j=0; i<tabCount && j<nDoc; i++) {
+    for (i=0, j=0; i<(tabCount-1) && j<nDoc; i++) {
        if (tabList[i]->core.being_destroyed)
            continue;
@@ -2500,7 +2518,7 @@ static void saveYourselfCB(Widget w, Widget appShell, XtPointer callData)
       XtVaGetValues(topWin->tabBar, XmNtabWidgetList, &tabs,
               XmNtabCount, &tabCount, NULL);
-       for (i=0; i< tabCount; i++) {
+       for (i=0; i< (tabCount-1); i++) {
           win = TabToWindow(tabs[i]);
            if (win->filenameSet) {
               /* add filename */
@@ -3441,7 +3459,7 @@ WindowInfo* CreateDocument(WindowInfo* shellWindow, const char* name)
    /* Set the requested hardware tab distance and useTabs in the text buffer */
    BufSetTabDistance(window->buffer, GetPrefTabDist(PLAIN_LANGUAGE_MODE));
    window->buffer->useTabs = GetPrefInsertTabs();
-    window->tab = addTab(window->tabBar, name);
+    window->tab = addTab(window->tabBar, name, False);
    /* add the window to the global window list, update the Windows menus */
    InvalidateWindowMenus();
@@ -3514,7 +3532,7 @@ static WindowInfo *getNextTabWindow(WindowInfo *window, int direction,
           XtVaGetValues(win->tabBar, XmNtabWidgetList, &tabList,
                   XmNtabCount, &tabCount, NULL);
-           for (i=0; i< tabCount; i++) {
+           for (i=0; i< (tabCount-1); i++) {
               tabs[tabTotalCount++] = tabList[i];
           }
       }
@@ -3524,7 +3542,7 @@ static WindowInfo *getNextTabWindow(WindowInfo *window, int direction,
       XtVaGetValues(window->tabBar, XmNtabWidgetList, &tabList,
               XmNtabCount, &tabCount, NULL);
-       for (i=0; i< tabCount; i++) {
+       for (i=0; i< (tabCount-1); i++) {
           if (TabToWindow(tabList[i]))    /* make sure tab is valid */
               tabs[tabTotalCount++] = tabList[i];
       }
@@ -3572,7 +3590,7 @@ static int getTabPosition(Widget tab)
    XtVaGetValues(tabBar, XmNtabWidgetList, &tabList,
            XmNtabCount, &tabCount, NULL);
-    for (i=0; i< tabCount; i++) {
+    for (i=0; i< (tabCount-1); i++) {
       if (tab == tabList[i])
           return i;
    }
@@ -4690,10 +4708,20 @@ static void raiseTabCB(Widget w, XtPointer clientData, XtPointer callData)
    XmLFolderCallbackStruct *cbs = (XmLFolderCallbackStruct *)callData;
    WidgetList tabList;
    Widget tab;
+    int tabCount;
-    XtVaGetValues(w, XmNtabWidgetList, &tabList, NULL);
-    tab = tabList[cbs->pos];
-    RaiseDocument(TabToWindow(tab));
+    XtVaGetValues(w, XmNtabWidgetList, &tabList, XmNtabCount, &tabCount, NULL);
+    if (cbs->pos < (tabCount-1)) {
+        tab = tabList[cbs->pos];
+        RaiseDocument(TabToWindow(tab));
+    } else {
+        WindowInfo *window = lastFocusDocument;
+        if (!window)
+            window = TabToWindow(tabList[cbs->pos - 2]);
+        EditNewFile(window, NULL, False, NULL, window->path, False);
+        CheckCloseDim();
+        cbs->allowActivate = 0;
+    }
 }
 static Widget containingPane(Widget w)
--
tg: (58cda00..) bw/newTabTab (depends on: master)
--
http://www.nedit.org/mailman/listinfo/discuss
--
NEdit Discuss mailing list - Discuss-***@public.gmane.org
http://www.nedit.org/mailman/listinfo/discuss
Bert Wesarg
2009-10-26 08:09:21 UTC
Permalink
Post by TK Soh
OT: where do you host your nedit repo? I'm trying to refresh my local
clone. Thanks.
Which one? I have a GIT mirror of the CVS repo here:

http://repo.or.cz/w/nedit.git

It looks like the free Mercurial repo service freehg.org is down, so I
need to look for a new one. I remember barely that you used the HG
mirror, so do you have a suggestion?

And my patch queue here:

http://repo.or.cz/w/nedit-bw.git

Bert
Post by TK Soh
TK
--
NEdit Discuss mailing list - Discuss-***@public.gmane.org
http://www.nedit.org/mailman/listinfo/discuss
TK Soh
2009-10-26 08:14:11 UTC
Permalink
Post by Bert Wesarg
Post by TK Soh
OT: where do you host your nedit repo? I'm trying to refresh my local
clone. Thanks.
http://repo.or.cz/w/nedit.git
It looks like the free Mercurial repo service freehg.org is down, so I
need to look for a new one. I remember barely that you used the HG
mirror, so do you have a suggestion?
You can use bitbucket.org to host mercurial repos for free, which is
where a lot of mercurial projects are hosted. It's a github for git.
Post by Bert Wesarg
http://repo.or.cz/w/nedit-bw.git
Bert
Post by TK Soh
TK
--
http://www.nedit.org/mailman/listinfo/discuss
--
NEdit Discuss mailing list - Discuss-***@public.gmane.org
http://www.nedit.org/mailman/listinfo/discuss
Bert Wesarg
2009-10-26 08:31:09 UTC
Permalink
Post by TK Soh
Post by Bert Wesarg
It looks like the free Mercurial repo service freehg.org is down, so I
need to look for a new one. I remember barely that you used the HG
mirror, so do you have a suggestion?
You can use bitbucket.org to host mercurial repos for free, which is
where a lot of mercurial projects are hosted. It's a github for git.
Thanks, I will create a repo there and update my scripts. Will report
back if its running.

Bert
--
NEdit Discuss mailing list - Discuss-***@public.gmane.org
http://www.nedit.org/mailman/listinfo/discuss
Bert Wesarg
2009-10-26 11:35:55 UTC
Permalink
Post by Bert Wesarg
Post by TK Soh
Post by Bert Wesarg
It looks like the free Mercurial repo service freehg.org is down, so I
need to look for a new one. I remember barely that you used the HG
mirror, so do you have a suggestion?
You can use bitbucket.org to host mercurial repos for free, which is
where a lot of mercurial projects are hosted. It's a github for git.
Thanks, I will create a repo there and update my scripts. Will report
back if its running.
TK,
can you please try it out:

http://bitbucket.org/bert.wesarg/nedit/

Thanks,
Post by Bert Wesarg
Bert
--
NEdit Discuss mailing list - Discuss-***@public.gmane.org
http://www.nedit.org/mailman/listinfo/discuss
TK Soh
2009-10-26 23:54:43 UTC
Permalink
On Mon, Oct 26, 2009 at 11:35 AM, Bert Wesarg
Post by Bert Wesarg
Post by Bert Wesarg
Post by TK Soh
Post by Bert Wesarg
It looks like the free Mercurial repo service freehg.org is down, so I
need to look for a new one. I remember barely that you used the HG
mirror, so do you have a suggestion?
You can use bitbucket.org to host mercurial repos for free, which is
where a lot of mercurial projects are hosted. It's a github for git.
Thanks, I will create a repo there and update my scripts. Will report
back if its running.
TK,
http://bitbucket.org/bert.wesarg/nedit/
Clone and build went well on my Fedora 9 box, with OM 2.3.0. Thanks.
Post by Bert Wesarg
Thanks,
Post by Bert Wesarg
Bert
--
http://www.nedit.org/mailman/listinfo/discuss
--
NEdit Discuss mailing list - Discuss-***@public.gmane.org
http://www.nedit.org/mailman/listinfo/discuss
TK Soh
2009-10-27 00:50:41 UTC
Permalink
Post by TK Soh
On Mon, Oct 26, 2009 at 11:35 AM, Bert Wesarg
Post by Bert Wesarg
Post by Bert Wesarg
Post by TK Soh
Post by Bert Wesarg
It looks like the free Mercurial repo service freehg.org is down, so I
need to look for a new one. I remember barely that you used the HG
mirror, so do you have a suggestion?
You can use bitbucket.org to host mercurial repos for free, which is
where a lot of mercurial projects are hosted. It's a github for git.
Thanks, I will create a repo there and update my scripts. Will report
back if its running.
TK,
http://bitbucket.org/bert.wesarg/nedit/
Clone and build went well on my Fedora 9 box, with OM 2.3.0. Thanks.
I tried your patch to both tip and BETA-5-6 branch, but failed to make:

window.c: In function 'raiseTabCB':
window.c:4721: error: too many arguments to function 'EditNewFile'

What did I misss?
--
NEdit Discuss mailing list - Discuss-***@public.gmane.org
http://www.nedit.org/mailman/listinfo/discuss
TK Soh
2009-10-27 01:22:49 UTC
Permalink
Post by TK Soh
Post by TK Soh
On Mon, Oct 26, 2009 at 11:35 AM, Bert Wesarg
Post by Bert Wesarg
Post by Bert Wesarg
Post by TK Soh
Post by Bert Wesarg
It looks like the free Mercurial repo service freehg.org is down, so I
need to look for a new one. I remember barely that you used the HG
mirror, so do you have a suggestion?
You can use bitbucket.org to host mercurial repos for free, which is
where a lot of mercurial projects are hosted. It's a github for git.
Thanks, I will create a repo there and update my scripts. Will report
back if its running.
TK,
http://bitbucket.org/bert.wesarg/nedit/
Clone and build went well on my Fedora 9 box, with OM 2.3.0. Thanks.
window.c:4721: error: too many arguments to function 'EditNewFile'
What did I misss?
FYI, I took out the last argv, and it seem to work now:

[***@protogen: ~/NEdit/wesarg]% hg diff
diff --git a/source/window.c b/source/window.c
--- a/source/window.c
+++ b/source/window.c
@@ -4718,7 +4718,7 @@
WindowInfo *window = lastFocusDocument;
if (!window)
window = TabToWindow(tabList[cbs->pos - 2]);
- EditNewFile(window, NULL, False, NULL, window->path, False);
+ EditNewFile(window, NULL, False, NULL, window->path);
CheckCloseDim();
cbs->allowActivate = 0;
}

The '+' tab has the same width as the others, but I understand this is
just a first draft. Nice work otherwise :-)
--
NEdit Discuss mailing list - Discuss-***@public.gmane.org
http://www.nedit.org/mailman/listinfo/discuss
Bert Wesarg
2009-10-27 07:16:38 UTC
Permalink
Post by Bert Wesarg
Post by TK Soh
window.c:4721: error: too many arguments to function 'EditNewFile'
What did I misss?
diff --git a/source/window.c b/source/window.c
--- a/source/window.c
+++ b/source/window.c
@@ -4718,7 +4718,7 @@
        WindowInfo *window = lastFocusDocument;
        if (!window)
            window = TabToWindow(tabList[cbs->pos - 2]);
-        EditNewFile(window, NULL, False, NULL, window->path, False);
+        EditNewFile(window, NULL, False, NULL, window->path);
        CheckCloseDim();
        cbs->allowActivate = 0;
    }
That should be correct, thanks.
Post by Bert Wesarg
The '+' tab has the same width as the others, but I understand this is
just a first draft. Nice work otherwise :-)
Now comes the motif experts into play, someone around? I will look
today into it, how I can beautify this tab.

Bert
Post by Bert Wesarg
--
http://www.nedit.org/mailman/listinfo/discuss
--
NEdit Discuss mailing list - Discuss-***@public.gmane.org
http://www.nedit.org/mailman/listinfo/discuss
TK Soh
2009-10-27 09:10:57 UTC
Permalink
Post by Bert Wesarg
Post by Bert Wesarg
Post by TK Soh
window.c:4721: error: too many arguments to function 'EditNewFile'
What did I misss?
diff --git a/source/window.c b/source/window.c
--- a/source/window.c
+++ b/source/window.c
@@ -4718,7 +4718,7 @@
        WindowInfo *window = lastFocusDocument;
        if (!window)
            window = TabToWindow(tabList[cbs->pos - 2]);
-        EditNewFile(window, NULL, False, NULL, window->path, False);
+        EditNewFile(window, NULL, False, NULL, window->path);
        CheckCloseDim();
        cbs->allowActivate = 0;
    }
That should be correct, thanks.
Post by Bert Wesarg
The '+' tab has the same width as the others, but I understand this is
just a first draft. Nice work otherwise :-)
Now comes the motif experts into play, someone around? I will look
today into it, how I can beautify this tab.
Thanks.

BTW, I ran into a coredump when opening new tab. To recreate, disable
'Hide Tab Bar...', then click on the '+' tab. Here's my quick fix on
top of my earlier one:

diff --git a/source/window.c b/source/window.c
--- a/source/window.c
+++ b/source/window.c
@@ -4715,9 +4715,7 @@
tab = tabList[cbs->pos];
RaiseDocument(TabToWindow(tab));
} else {
- WindowInfo *window = lastFocusDocument;
- if (!window)
- window = TabToWindow(tabList[cbs->pos - 2]);
+ WindowInfo *window = GetTopDocument(w);
EditNewFile(window, NULL, False, NULL, window->path);
CheckCloseDim();
cbs->allowActivate = 0;

The patch also open the new tab using the path of the top/active
document, which I feel it's more consistent with original nedit
behavior on opening new tab.

It's been some time since I last looked at nedit source code, so I'm
not sure if I might miss out something here.
--
NEdit Discuss mailing list - Discuss-***@public.gmane.org
http://www.nedit.org/mailman/listinfo/discuss
Bert Wesarg
2009-10-27 10:11:19 UTC
Permalink
Post by TK Soh
Thanks.
BTW, I ran into a coredump when opening new tab. To recreate, disable
'Hide Tab Bar...', then click on the '+' tab. Here's my quick fix on
diff --git a/source/window.c b/source/window.c
--- a/source/window.c
+++ b/source/window.c
@@ -4715,9 +4715,7 @@
        tab = tabList[cbs->pos];
        RaiseDocument(TabToWindow(tab));
    } else {
-        WindowInfo *window = lastFocusDocument;
-        if (!window)
-            window = TabToWindow(tabList[cbs->pos - 2]);
+        WindowInfo *window = GetTopDocument(w);
        EditNewFile(window, NULL, False, NULL, window->path);
        CheckCloseDim();
        cbs->allowActivate = 0;
The patch also open the new tab using the path of the top/active
document, which I feel it's more consistent with original nedit
behavior on opening new tab.
Ahh, this was what I indented. But got it wrong. Thanks.

Bert
--
NEdit Discuss mailing list - Discuss-***@public.gmane.org
http://www.nedit.org/mailman/listinfo/discuss
Loading...