TinTin++ Mud Client The TinTin++ message board

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
TinTin++ Mud Client

prompt shows above split

 
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> General Discussion
View previous topic :: View next topic  
Author Message
Miesco



Joined: 08 Sep 2005
Posts: 16

PostPosted: Wed Aug 04, 2010 6:10 pm    Post subject: prompt shows above split Reply with quote

#####################
You pick an ear of corn off the stalk.
> #prompt {^>%*} {> }
#OK. {^>%*} NOW PROMPTS {> } @ {1}.

>


>
<I type here>
#####################

So it displays '>' right where the split line (------) should be... shouldn't the prompt be on the input line right before I type without a line feed? like:

> <I type here>
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Wed Aug 04, 2010 6:54 pm    Post subject: Reply with quote

It's supposed to go on the split line by default. If you parse and color your prompt you can create something like this:

Back to top
View user's profile Send private message Send e-mail
Miesco



Joined: 08 Sep 2005
Posts: 16

PostPosted: Wed Aug 04, 2010 7:13 pm    Post subject: Reply with quote

How do I make it go on the input line BEFORE input?
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Wed Aug 04, 2010 8:39 pm    Post subject: Reply with quote

Can't be done, and it's too much trouble to implement.
Back to top
View user's profile Send private message Send e-mail
Miesco



Joined: 08 Sep 2005
Posts: 16

PostPosted: Wed Aug 11, 2010 3:16 am    Post subject: Reply with quote

If I send a patch can consider it?
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Wed Aug 11, 2010 7:14 am    Post subject: Reply with quote

If you make it work with: #showme {test> } {0} and it works flawlessly with all the cursor macros, doesn't mess up input as it's being typed, and doesn't take too many lines of code, I'll seriously consider it.
Back to top
View user's profile Send private message Send e-mail
Miesco



Joined: 08 Sep 2005
Posts: 16

PostPosted: Sat Aug 14, 2010 6:25 pm    Post subject: Reply with quote

Here it is, the prompt on input line:


Code:

diff -u ../../tto/src/prompt.c ./prompt.c
--- ../../tto/src/prompt.c   2010-07-29 03:40:22.000000000 +0000
+++ ./prompt.c   2010-08-14 23:17:48.000000000 +0000
@@ -135,16 +135,24 @@
       sprintf(temp, "#PROMPT SIZE (%d) LONGER THAN ROW SIZE (%d)", (int) strlen(temp), ses->cols);
    }
 
+   if (row == ses->rows && strlen(temp) != 0)
+   {
+      goto_rowcol(ses, row, strlen(temp)+1);
+      gtd->input_off = strlen(temp)+1;
+   }
+
    if (!HAS_BIT(ses->flags, SES_FLAG_READMUD) && IS_SPLIT(ses))
    {
       save_pos(ses);
    }
 
+         show_debug(ses, LIST_PROMPT, "#DEBUG ses-rows: %d; ses-botrow: %d; row: %d", ses->rows, ses->bot_row, row);
    /*
       goto row, erase to eol, print prompt, goto bot_row
    */
 
-   printf("\033[%d;1H\033[%d;1H\033[K%s\033[%d;1H", row, row, temp, ses->bot_row);
+/*    printf("\033[%d;1H\033[%d;1H\033[K%s\033[%d;1H", row, row, temp, ses->bot_row);*/
+   printf("\033[%d;1H\033[K%s\033[%d;1H", row, temp, ses->bot_row);
 
    if (!HAS_BIT(ses->flags, SES_FLAG_READMUD) && IS_SPLIT(ses))
    {

diff -u ../../tto/src/vt102.c ./vt102.c
--- ../../tto/src/vt102.c   2010-03-31 16:54:34.000000000 +0000
+++ ./vt102.c   2010-08-14 19:58:03.000000000 +0000
@@ -29,19 +29,21 @@
 
 void save_pos(struct session *ses)
 {
-   printf("\0337");
+/*    printf("\0337"); */
 
    ses->sav_row = ses->cur_row;
    ses->sav_col = ses->cur_col;
+   printf("\033[%d;%dH", ses->cur_row, ses->cur_col);
 }
 
 
 void restore_pos(struct session *ses)
 {
-   printf("\0338\0338");
+/*    printf("\0338\0338"); */
 
    ses->cur_row = ses->sav_row;
    ses->cur_col = ses->sav_col;
+   printf("\033[%d;%dH", ses->cur_row, ses->cur_col);
 }
 
 void restore_cursor(struct session *ses)
@@ -54,6 +56,7 @@
    printf("\033[%d;%dH", row, col);
 
    ses->cur_row = row;
+   ses->cur_col = col;
 }
[/code]
Back to top
View user's profile Send private message
Miesco



Joined: 08 Sep 2005
Posts: 16

PostPosted: Sat Aug 14, 2010 6:29 pm    Post subject: Reply with quote

I changed the restore_pos and save_pos, I will put them back to the old ones and add restore_cursor and save_cursor, and replace the restore_pos and save_pos to the new cursor ones.

The code works with #showme {prompt>} 0, it works with all cursor macros I tested (the main ones, like 6 of them)
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Sat Aug 14, 2010 8:50 pm    Post subject: Reply with quote

Not a bad idea to use input_off, though it'll mess things up whenever you use ctrl-r.

There's really no need to mess with the vt102.c stuff, and the \033[%d;1H\033[%d;1H usage is intentional to deal with a problem with certain terminal emulators.

I modified it to echo the input, the following should do the trick:

Code:

        len = (int) strlen(temp);

        if (!HAS_BIT(ses->flags, SES_FLAG_READMUD) && IS_SPLIT(ses))
        {
                save_pos(ses);
        }
         
        if (row == ses->rows)
        {
                gtd->input_off = len + 1;
                                         
                printf("\033[%d;1H\033[%d;1H\033[K%s%s\033[%d;%dH\0337\033[%d;1H", row, row, temp, gtd->input_buf, row, len + gtd->input_cur + 1, ses->bot_row);
        }
        else
        {   

                // goto row, erase to eol, print prompt, goto bot_row

                printf("\033[%d;1H\033[%d;1H\033[K%s\033[%d;1H", row, row, temp, ses->bot_row);
        }

        if (!HAS_BIT(ses->flags, SES_FLAG_READMUD) && IS_SPLIT(ses))
        {
                restore_pos(ses);
        }


That'll be in for the next release, unless it needs some further tweaking.
Back to top
View user's profile Send private message Send e-mail
Miesco



Joined: 08 Sep 2005
Posts: 16

PostPosted: Sun Aug 15, 2010 2:31 am    Post subject: Reply with quote

Thanks.

Doesn't save_pos only save the line and not col?

Also, I was thinking about implementing a split without the split line. Do you think that is a good idea now that you can have an input prompt?
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Sun Aug 15, 2010 7:54 am    Post subject: Reply with quote

Save_pos calls \0337 which is a vt102 code that saves the exact position.

Using #split 0 0 should do the trick.
Back to top
View user's profile Send private message Send e-mail
Miesco



Joined: 08 Sep 2005
Posts: 16

PostPosted: Mon Aug 16, 2010 4:41 am    Post subject: Reply with quote

Nice! So do you want help fixing bugs or anything? Is that TODO in 2.0.3 up to date?
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Mon Aug 16, 2010 7:15 am    Post subject: Reply with quote

The only real bug left is that strings aren't dynamic, and I'd rather mess with that myself as that'll require going over everything.

Sharing cool scripts for the MUD you play on (google sites offers free webspace) is a good way to contribute, and if there's something in particular you want to mess with feel free to bring it up.
Back to top
View user's profile Send private message Send e-mail
Oreolek



Joined: 27 Sep 2015
Posts: 1

PostPosted: Sun Sep 27, 2015 7:02 am    Post subject: Reply with quote

So, how does it work in the current version?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> General Discussion All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads
TinTin++ Homepage

Powered by phpBB © 2001, 2002 phpBB Group