intfiction.org

The Interactive Fiction Community Forum
It is currently Sat May 18, 2013 11:58 pm

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: FrobTads and Emacs
PostPosted: Tue May 08, 2012 12:10 am 
Offline

Joined: Tue May 08, 2012 12:04 am
Posts: 2
This one is a little obscure, but I thought I'd post anyhow...

FrobTads works fine almost everywhere, but there is an issue if you run it within an Emacs ansi-term (or multi-term) buffer: after the first full or even partially full screen, more or less, some of the text starts to get scrambled --- words out of order, words missing, stray stuff, etc. The only thing that works reliably is the "-i plain" option.

The problem is at least as likely to be in Emacs and/or components as it is to be in FrobTads, and I'm trying to track it down. But I wonder if anyone else has seen this? I realize this is not exactly a mainstream method of running FrobTads, but when I get in Emacs I kind of like to live there; it's typical of Emacs fanaticism.

This is, by the way, with the latest FrobTads (from the FrobTads site), Emacs 23.1, Ubuntu 10.04, Gnome.


Top
 Profile Send private message  
 
 Post subject: Re: FrobTads and Emacs
PostPosted: Tue May 08, 2012 3:47 am 
Offline

Joined: Sun Aug 14, 2011 6:21 am
Posts: 127
Without knowing really anything about the underlying implementation of both FrobTads and Emacs, it sounds to me like a bug in memory allocation/reallocation for the scrollback buffer. Since the problem only exists in FrobTads and Emacs can be considered to be quite mature, I think we can assume that it's somewhere in the FrobTads code.

Is FrobTads written purely in Emacs Lisp or does it have portions written in C?

_________________
Grotesque: an interactive fiction library manager for Linux
PyIFBabel: a Treaty of Babel library for Python


Top
 Profile Send private message  
 
 Post subject: Re: FrobTads and Emacs
PostPosted: Tue May 08, 2012 4:30 am 
Offline
User avatar

Joined: Tue Apr 20, 2010 2:48 pm
Posts: 680
(FrobTADS is written in C++ (T3) and C (T2).)

I suspect that it doesn't get the terminal height right. I will try to reproduce when I get a chance later today.


Top
 Profile Send private message  
 
 Post subject: Re: FrobTads and Emacs
PostPosted: Tue May 08, 2012 8:12 am 
Offline
User avatar

Joined: Tue Apr 20, 2010 2:48 pm
Posts: 680
I found the problem. It is related to terminal dimensions and looks like a bug in Emacs, though I can't be 100% sure. The problem is that frob sets the LINES and COLUMNS env vars. This isn't strictly necessary, but solves a bug in some curses versions. However, Emacs seems to get confused when this happens. I will need to ask the Emacs devs about this.

To fix the issue for now, you can edit src/frobtadsappcurses.cc and in lines 259 and 260 find this code:

Code:
putenv(linesEnv);
putenv(columnsEnv);

Simply delete or comment-out these two lines.


Top
 Profile Send private message  
 
 Post subject: Re: FrobTads and Emacs
PostPosted: Tue May 08, 2012 12:54 pm 
Offline

Joined: Tue May 08, 2012 12:04 am
Posts: 2
The fix worked perfectly, thank you very much for taking the time to research and deal with such an obscure issue.

I might spend a little time digging into ansi-term and multi-term to see where the real problem lies, though the very idea of expecting to be able to run literally anything in an Emacs buffer is something only true believers embrace. (Obviously I am one of those.)

At least I was able to take out the ugly workaround in my GGZC bash wrapper which tested for the presence of Emacs as a parent process and forced "-i plain" if so!


Top
 Profile Send private message  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


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 post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group